![]() The only difference is in the syntax of emitting state. ![]() You can swap “cubit” in the picture above and nothing will change. This approach is literally the same as State Notifier from a developer’s perspective. As illustrated by Bloc authors, the workflow of Cubit looks the following way: The reason being is that Cubit while being a bit simplified version of Bloc, looks and feels exactly the same way as State Notifier for a developer. Bloc/Cubit and State Notifierįirst of all, we are going to throw out Cubit from this comparison. Let’s start by comparing the state management packages. Riverpod on the other hand is literally Provider 2.0 for DI and has a State Notifier package bundled with it for state management (and the name Riverpod is an anagram of the Provider for the reason that it’s next generation Provider). Both of these packages can be virtually split into two parts: dependency injection and state management.īloc uses its own extensions of the Provider package for DI and Bloc or Cubit classes for storing state. Riverpod and Bloc are the most prominent packages which promote an immutable state (meaning that you cannot change the state of the app from the UI, so you eliminate the possibility of a rogue code behaving unpredictably).Ĭomparing Riverpod and Bloc is not strictly a correct approach. There are countless threads on Twitter and Reddit posts that pitch one solution against another or preach a pure solution of only using Flutter-provided classes like ChangeNotifier, but when it comes to real-life products, you have to decide on a stack of third parties and approaches that would be most beneficial to your team and your app. One of the most actively asked questions from Flutter beginners is “What is the best state management library?”. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |