State management: Pros and Cons of popular methods in Flutter

state management

State management is simply the state of managing user interface controls. For example: buttons, icons and fields. Simple as it may sound, it can grow into one of the most complex issues when the systems develop if it is not handled wisely. Thus, today, let’s have a look at multiple common methods in Flutter. ArrowHiTech hopes that you will understand what to opt for your own web and app because there are no best state managements. In fact, there only are the suitable ones!

If you are new to Flutter, check out our articles Flutter state management: Pros and Cons of popular methods

List of Common Flutter state management Approaches

  1. Provider
  2. ScopedModel
  3. setState
  4. InheritedWidget & InheritedModel
  5. Redux
  6. BLoC/Rx
  7. MobX

Now, it’s time to go into details about each Flutter state management method’s pros and cons!

1. Provider

Provider is an UI tool. Similar to a state model object, this Flutter state management method is a widget that makes value available to the widgets below it.

state management provider

Pros:

  • Offer numerous options
  • Flexible
  • use ‘ChangeNotifier’ (Flutter framework).

Cons:

  • Fairly difficult to use

Flutter app: How to improve its performance?

2. ScopedModel

ScopedModel is another common Flutter state management method. It is a set of utilities that allow data to pass from parent to children’s widget. Moreover, when the model is updated, SM automatically resets all the children components.

Pros:

  • Separate UI and Business logic
  • set up with one-way directional data flow

Cons:

  • Too many excessive updates

3. setState

This is the default Flutter state management method. Moreover, there are two main types of setState. They are setStateWith and setStateAfter. Here, the name itself has explained clearly.

Pros:

  • Easy to understand
  • Good to handle UI State or local State (ephemeral State)

Cons:

  • Share state across components
  • Distant leaf components need access to states
  • Can breaks clean code principles

4. InheritedWidget

As seen from the photo, this is a very special type of Flutter state management method. In short, it defines data at the root of the sub-tree! Therefore, IW can transmit the data to all branches in the same sub-tree.

state management inheritedwidget

Pros:

  • Easy to understand basic ideas

Cons:

  • Hard to explain details

Although this method is dismissed regularly, using it in the correct way still bears the same, even more efficiency! This article from Eric Windmill really helps!

5. Redux

Redux describes themselves as ‘a predictable state container for JavaScript apps’. As for Flutter, this Flutter state management method helps develop, test and manage apps.

Pros:

  • Unidirectional data flow
  • Easy debugging
  • Able to keep the 5 latest versions

Cons:

  • Super excessive amount of codes need writing (boilerplate)
  • Side effects of asynchronous works

If you also use React, don’t forget to check out this article:

6. BLoC/Rx

BLoC or Business Logic Components makes everything in the app represented as a stream of events. For example, if widgets submit events, BLoC sits in the middle, managing the conversation while other widgets respond. 

state management bloc

Pros:

  • Easy to test and reuse codes
  • Separate UI from logic
  • Better performance

Cons:

  • Lots of codings
  • Need to use streams in both directions

7. MobX

To sum up, MobX is a Flutter state management library. In addition, MobX gets reactive programming that is different to Stream/RxDart reactive to value. 

Pros:

  • Abstracts the mechanism of updating a component
  • easy to connect the reactive app data with the UI.
  • rapid prototyping

Cons:

  • Only suitable for small apps 

That’s all the benefits and drawbacks of Flutter state management methods. However, to figure out the exact situation of your app to choose which method is no easy task. Therefore, we highly recommend experts like ArrowHiTech!

Why AHT?

  • Rich Experience: ArrowHiTech was founded in 2007. Today, we are one of the leading IT outsourcing companies in Vietnam. Throughout 13 years, we have met the demands of more than 1,000 customers and completed more than 10,000 projects worldwide. Language border is non-existent when working with us!
  • Low Cost: Located in Vietnam, hence, our labour fee is extremely affordable. We always provide a wide range of selection with different prices so that any customers can choose their favorite and suitable ones.
arrowhitech
  • High Quality: Although ArrowHiTech provides fair prices, our products are always high quality. You can check out our portfolios, as well as others’ ratings and reviews right here.
  • Strong Dedication: We believe that dedication and passion is the core value which results in the optimal working experience. Our team always prioritizes customers’ needs and demands. ArrowHiTech believes that this is our strength and our must-have value to our responsibility towards every single client. 

For those reasons, you can fully trust us on any State Management issues! You can see our Flutter App Development Services to see some further works of ours.

Bottom line

That is the end for this topic! Overall, we have presented 7 most common state management methods for your Flutter app and site. It seems to be a minor issue that anyone can ignore, but in fact, a group small details can have the same, or even bigger effect than major ones.

If you need help, ArrowHiTech is just one call away. As always, we wish the best of luck to you and your future successful business! 

For more information Contact Us

Tags

Share