Flutter state management
Provider, Riverpod 3 and BLoC/Cubit — a deep dive into Flutter state management: the mechanics underneath, testing, performance, architecture, migration and interview questions.
Stages
Foundational mechanics
Every state management library is built on the same handful of Flutter mechanics: the rebuild model, InheritedWidget and Listenable. Without them, choosing a library is a matter of taste.
Provider and ChangeNotifier
The most widespread and most misused approach. Knowing Provider is mandatory: `flutter_bloc` is built on top of it, and much of every legacy codebase is written with it.
🔓 Recommended after: Foundational mechanics
Riverpod 3
Written by Provider's own author to fix its limitations: providers live outside the tree, async state comes built in, and anything can be replaced in a test. This stage follows the 3.x APIs.
🔓 Recommended after: Provider and ChangeNotifier
BLoC and Cubit
The choice of large teams and products that need an audit trail: every state change is triggered by a named event. This stage follows the bloc 9.x and flutter_bloc 9.x APIs.
🔓 Recommended after: Riverpod 3
Architecture, immutability and performance
Choosing a state management library is only part of the architecture. This stage is about which layer state belongs to, how immutability ties into performance, and how rebuilds are controlled — where most senior interview questions come from.
🔓 Recommended after: BLoC and Cubit
Migration and code generation
Real projects are not written from scratch: the code is full of older APIs and libraries ship major versions. This stage is about migration strategies and codegen — the answer to the "what would you do with the legacy?" question in senior interviews.
🔓 Recommended after: Architecture, immutability and performance
Interview preparation
The stage that turns knowledge into answers: comparison arguments, rapid-fire questions, live coding and code review scenarios. Every answer is pitched at the middle → senior expectation.
🔓 Recommended after: Migration and code generation
📚 Sources and documentation
- Flutter: state management optionsofficialdocs.flutter.dev
The Flutter team's official position — what approaches exist and what the choice depends on.
- Flutter architecture guideofficialdocs.flutter.dev
The official answer to where state should live: view, view model, repository, service.
- Flutter architecture: case studyofficialdocs.flutter.dev
How the guide's principles look in real project code.