Stream Builder – Widget exploration

Stream Builder Widget Exploration

Modern apps are asynchronous and we have to deal continuously with new data that updates our widgets. To do so, Dart gives us Streams, and it comes with a handy widget: StreamBuilder.

You have to give a stream to listen to and a builder function that will return what the UI will render with that data.

You can provide it with initial data so the Steam Builder has something do show while it’s waiting for the first event.

Otherwise you can check if data is available. If it’s not, show something like a progress indicator.

The Stream Builder widget will render it’s content every time new data arrives, but it will not render whatever widgets are not container in it’s builder function. This is important to keep in mind when you need only a portion of your UI to update.

Read my full article about Stream Controllers usage with BLoC pattern:

Share the Post:

Related Posts