How to do state management with this library?
Say I have used react-redux -
Where I store all the data in redux state and whenever any data is needed on any page I get that data from the state.
With flutter_bloc whenever I have to get the data I am calling dispatch/add method which in turn makes a server call as the call.
How can I not call the server and get data from the state?
Hi @HathTech 馃憢
Thanks for opening an issue!
With flutter_bloc, each bloc maintains its own state. You can modify that state by adding events to the bloc. When an event is added, mapEventToState is triggered and the bloc must transform that event into a new state. Calling add does not make a server call, it simply calls mapEventToState and the bloc can do whatever it wants in order to determine the next state. You can then use BlocBuilder to re-render your UI whenever a bloc state changes.
I highly recommend going through the official documentation before starting to write any code.
Hope that helps 馃憤
Awesome thank you :)
Most helpful comment
Awesome thank you :)