Flutter deliberately doesn’t force one state management approach on you — everything from setState to full packages like Riverpod and Bloc is a supported, legitimate choice, and the right one depends on how big your app is and how state needs to move around it. This guide covers the built-in tools first, then the most-used third-party packages.
The Foundation: setState and Widget Types
Before reaching for a package, make sure you’re solid on what Flutter gives you out of the box — most small-to-medium apps use these for at least some of their state, even alongside a package for the rest:
- StatefulWidget vs StatelessWidget — the fundamental split every Flutter widget is built on.
- setState — what it actually does, and when it’s genuinely the right tool rather than a beginner-only shortcut.
- Widget Keys — ValueKey, ObjectKey, and GlobalKey, for when a reorderable list starts losing track of item state.
Comparing the Major Packages
Once state needs to be shared across widgets that aren’t directly related, or you need proper async loading/error handling, it’s time for a package:
- Provider — a lightweight wrapper around InheritedWidget, built on ChangeNotifier. The gentlest learning curve of the three.
- Riverpod — a redesign of Provider with compile-time safety and built-in async state handling via AsyncValue. A strong default for new projects.
- Bloc and Cubit — an event-driven pattern that trades more boilerplate for very traceable, easily testable state changes.
A Rough Decision Guide
There’s no universally “correct” choice — all three packages above are actively maintained and used in production apps. As a starting point:
- Small app, or state truly local to one screen — stick with
setState, no package needed. - Need to share state across screens with minimal ceremony, and you’re already comfortable with
ChangeNotifier— Provider. - Starting a new project and want compile-time safety plus clean handling of API/loading states — Riverpod.
- Working on a larger team that values highly traceable, event-sourced state changes (useful for analytics or auditing) — Bloc.
Where This Connects to the UI
All of this state ultimately drives the widgets covered in our Flutter Widgets Guide — state management decides where a value lives; the widget catalog covers what you build with it once you have it.