Since I want to work with multiple streams in parallel, I am interested in how Streambuilder works exactly. Did I understand correctly that when Streambuilder receives a stream, it updates the build method?
Currently, when Streambuilder receives a stream, it updates the state of the entire widget each time. I thought it only updates the child Widget (in this case Text) in streambuilder and not the complete widget.
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
StreamBuilder<Map>(
stream: NumberCreator().stream,
builder: (context, snapshot) {
return Text(snapshot.data['test']);
}),
StreamBuilder<Map>(
stream: OtherCounter().stream,
builder: (context, snapshot) {
return Text(snapshot.data['test2']);
}),
],
),
);
}
I want to work with multiple streambuilders in a stack in a stateful widget. Is it better to outsource the streambuilders to their own stateless widgets or what would be a recommended architecture?