Home > Blockchain >  Does The Bloc Pattern Include State Management?
Does The Bloc Pattern Include State Management?

Time:02-16

This may be a noob question but I am new to Flutter. Hearing all those keywords: "State Management, Provider, Redux, MVVM and Bloc", I get a little bit confused.

When implementing the Bloc pattern, is it that you already implemented state management? Does this (in most cases) mean that I do not need to use another tool like Redux or Provider? To get a better idea, I am going to build a mobile webshop using Flutter and the Woocommerce package.

If I understand correctly with the Bloc pattern you have the follow:

  • UI screen (view)
  • BLOC (ViewModel, including functions such as getting data or updating data or deleting data)
  • Repository (Get's data from an API)
  • Network Provider (the api itself)

If it's not complete, feel free to add an extra explanation.

Hope anyone has clear answers!

Cheers

CodePudding user response:

When implementing the Bloc pattern, is it that you already implemented state management?

Yes indeed.

Does this (in most cases) mean that I do not need to use another tool like Redux or Provider?

You can use them, but personally, I see no need when I already use BLoC and would not mix them.

CodePudding user response:

Yes bloc itself is a state management tool in flutter and there is no need to use any other state management tools along with it. Though it can be done but try to use single state management for whole app so that mismatch doesnot happen . Also Bloc makes sure to preserve the state and update it when necessary. That is what state management is !

  • Related