Flutter Blocs: A Simple Introduction | by Sumit Ghosh | Feb, 2022

1. How to make Bloc available to the Widget tree (UI)?

The Widget which gives this functionality is the BlocProvider widget, BlocProvider makes the bloc available to the entire Widget tree, which is passed in the child parameter.

2. How to trigger an Event from UI on some action?

Now that we have Bloc available on the Widget tree we can access it from anywhere, there are two ways to do that, —


3. But how will UI update itself when a new state is Emitted?

Yes, you guessed that right, there is a widget for this too. It’s called Bloc Consumer.

Leave a Comment