As you try to inject Bloc or Cubit to your app, sometimes it maybe that you have the below error In general you get the error due to incorrect place bloc or provider injection. Your MultiProvider or MultiBlocProvider should be at the very top and MaterialApp should be the child of MultiProvider or MultiBlocProvider That’s…
Category: BLoC & Cubit
Flutter Cubit or BLoC
First thing you need to know about BLoC, it’s a state management system that works with states and events. With BLoC you need to trigger an event and for that related event you should emit a state. In general events pass data from UI to the shared memory of BLoC or Flutter. Then using state…
Cubit and MultiBlocProvider
If you just use BLoC, you may MultiBlocProvider to inject your blocs at one time. What if you use Cubit? We know Cubit is sub set of BLoC and it works the same as BLoC provider injection. There’s nothing called MultiCubitProvider. From the picture, you see that we have injected all the Cubits using MultiBlocProvider….
Flutter BLoC Custom Tab Bar | Load Network Data
Here we will see how to create a custom tab bar and load network data using RepositoryProvider and how tabs loads data on button click. Our tab bar would be responsive to click which means we will maintain state of the tabs. Certain tab will load certain data from the network. Network data loader functions…
Flutter BLoC RepositoryProvider
Flutter BLoC RepositoryProvider is needed when you network call or api request inside from a controller. That means if you have a controller, you should assign it inside RepositoryProvider, then the class would get loaded first. This controller class would hold methods and fields, that’s necessary when you trigger events and load data or pass…
Flutter Circular Progress Indicator Animation BLoC
Here we will carry on from the first part, where we learned how to make a timer app using BLoC pattern. Then in part two we learned how to make a linear progress indicator. In this part we will see how to make circular progress indicator. As usual we will use elapsed time to do…
How to Stop a Timer in Flutter BLoC
It may sound tricky to stop a timer app in bloc. In fact it’s easy. First you have to understand why your BLoC started to run the timer app? It’s because you triggered an event. That event emitted a state, and because of that state we were able to start the timer. First we emitted…
Flutter LinearProgressIndicator
Flutter LinearProgressIndicator is cool for slowly showing animation or progress. It shows animation in a line or in a straight line. If you have a timer app in Flutter, you may use timer to show progress of the elapsed time. it could be used to show download progress as well. LinearProgressIndicator Widget In general, you…
Flutter BLoC emit List()
Here we will see how to emit() List using flutter BLoC. BLoC state management emits any states and can be found from UI. First we will create event classes. The event classes would be responsible triggering events. Now let’s create state classes. Here LoadedList extends Equitable class and it makes this class stateful. This also…
What’s Flutter BLoC state object?
Flutter BLoC state is an amazing object. It’s store all the data related to that BLoC class or Cubit class. If you use int, String, List or Map type object in your BLoC or Cubit class, You can find all of them from the state object. state is State object. State class extends Object class,…