📱 Flutter Intermediate

What is ChangeNotifier in Flutter?

Answer

ChangeNotifier is a simple class from the Flutter foundation that provides a notification mechanism. You extend it in your state model class, and call notifyListeners() whenever the state changes. Widgets that are watching this notifier (via Provider's context.watch() or Consumer) will automatically rebuild. It is the backbone of Provider-based state management. For more scalable alternatives, Riverpod's NotifierProvider and BLoC are commonly used.