简体   繁体   中英

Does The Bloc Pattern Include State Management?

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

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.

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 !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM