The ChangeNotifierProvider Widget
Learn about the ChangeNotifierProvider widget in Riverpod and how it works.
Riverpod’s ChangeNotifierProvider
In the previous lesson, we combine both the Riverpod and Provider
packages. We’ve seen the most critical part of state management with Riverpod. We mixed Riverpod and the old Provider
package to have some coding fun. We also checked how we could reduce widget rebuilds.
We have also discussed Provider
's ChangeNotifierProvider
in great detail previously. The new Riverpod state management package also uses the same ChangeNotifierProvider
but with a particular flavor, making it more advanced.
Provider
's ChangeNotifierProvider
Let us summarize and state the ChangeNotifierProvider
's main points in the Provider
package.
We have seen and used such cases in our early examples. A model class that extends ChangeNotifier
can call notifyListeners()
any time the state in that class is changed or updated.
In a model-view-controller pattern, we notify the UI to rebuild the layout ...