Using ChangeNotifier to architect your apps?

Feel like you can use something better?

Bloc? Feels too Complex?

Enter StateNotifier, a new way to architect your Provider apps. Well, technically no, but you’ll see what I mean.

The problem with ChangeNotifier,

ChangeNotifier might be the simplest and least boilerplate state management in flutter but it does have its own limitations. The ability to use immutable states is the one I would say lacks the most, ChangeNotifier also has slower time complexities such as O(N²) for notifylisteners() and O(N) for **addListener(). **Injecting your dependency service might be another headache.

_So How is __StateNotifier _different?

If you have used **ValueNotifier, **it is not so different, In fact, It is a reimplementation of ValueNotifier outside of **Flutter **withsome key differences. I’ll list a few but you can check out the documentation for more on pub_.dev_

StateNotifier is independent of flutter, It has improved time complexities for notifying and adding listeners. It exposes the ValueNotifier.value called **state, **which will be the key concept in this architecture.

#flutter #state-management #provider

Upgrading from ChangeNotifier
1.45 GEEK