Close

2020-02-02

How to Manage State in Flutter using BLoC for Beginners

How to Manage State in Flutter using BLoC for Beginners

Bloc is one of the best ways to manage the state in your Flutter app. It can seem a bit confusing at first glance, but this video will hopefully clear up the confusion and show how easy it is to implement in any existing app.

github page for the source code

00:47 - Explaining initial code and the goal of this video 
02:26 - Creating a BLoC Event class 
05:59 - Creating the BLoC to define the state and handle the event 
12:38 - Creating a BlocDelegate to intercept events, state changes, and related errors 
15:25 - Assigning the BlocDelegate when the app starts 
16:12 - Using a BlocProvider to provide the BLoC to the app 17:25 - Updating the BLoC state with an event 
20:03 - Using a BlocConsumer to consume the BLoC state in a widget 
23:49 - Showing a SnackBar message when a new event is found 
24:45 - How to decide when a widget is rebuilt on new events 
28:39 - Testing/Debugging (Adding and deleting items from the List state)