"Which state management library should I use for Flutter" comes up in nearly every architecture review, and the answer that circulates most ("Bloc for big projects, Provider for small ones") is too vague to be useful. All three solutions solve the same underlying problem, propagating state and its changes without rebuilding the entire widget tree, but with very different tradeoffs on boilerplate, testability, and how easy it is to onboard a team. The right choice depends less on project size than on the team discipline you can enforce and the real complexity of the async flows you need to handle.

The common problem: setState stops being enough

Inside a single StatefulWidget, setState rebuilds that local widget, which is fine for a counter or a form field. The problem shows up once the same piece of state (the logged-in user, the cart, a filtered list) needs to be read and updated from several screens with no direct parent-child relationship. Pushing state up through callbacks across five widget levels ("prop drilling") quickly becomes unreadable, and duplicating the state in each screen causes drift between copies.

All three solutions solve this via InheritedWidget under the hood (Provider and Riverpod expose it more or less directly, Bloc relies on BlocProvider doing the same thing), but with different philosophies on how to model state change itself.

Provider: the minimum viable option, with known limits

Provider wraps InheritedWidget in a simpler API and remains the lightest entry point for anyone first learning Flutter state management.

class CartModel extends ChangeNotifier {
  final List<CartItem> _items = [];
  List<CartItem> get items => List.unmodifiable(_items);

  double get total => _items.fold(0, (sum, item) => sum + item.price * item.quantity);

  void addItem(CartItem item) {
    _items.add(item);
    notifyListeners();
  }
}

// main.dart
ChangeNotifierProvider(
  create: (_) => CartModel(),
  child: const MyApp(),
);

// in any child widget, anywhere in the tree
final cart = context.watch<CartModel>();
Text('${cart.items.length} items');

The limits show up on medium-sized projects: ChangeNotifier forces a mutable class with notifyListeners() called manually, which makes it easy to forget a spot and end up with a screen that silently doesn't update. The dependency on BuildContext to read or write state (context.read, context.watch) complicates pure unit tests (without mounting a widget tree) and decoupling business logic from the UI layer.

Riverpod: the same idea, without the widget-tree dependency

Riverpod was written by the same author as Provider specifically to fix these limits. The main structural difference is that Riverpod "providers" exist independently of BuildContext and are declared as global variables (but testable and overridable ones), which makes business logic testable without mounting any widget.

// cart_provider.dart
class CartState {
  final List<CartItem> items;
  const CartState(this.items);
  double get total => items.fold(0, (sum, item) => sum + item.price * item.quantity);
}

class CartNotifier extends Notifier<CartState> {
  @override
  CartState build() => const CartState([]);

  void addItem(CartItem item) {
    state = CartState([...state.items, item]);
  }
}

final cartProvider = NotifierProvider<CartNotifier, CartState>(CartNotifier.new);

// in a widget, using ConsumerWidget
class CartScreen extends ConsumerWidget {
  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final cart = ref.watch(cartProvider);
    return Text('${cart.items.length} items - ${cart.total} USD');
  }
}

The real practical advantage is native async handling via FutureProvider and AsyncValue, which explicitly encodes the three states (loading, data, error) without repetitive boilerplate:

final userProfileProvider = FutureProvider<UserProfile>((ref) async {
  final api = ref.watch(apiClientProvider);
  return api.fetchProfile();
});

// in the widget
ref.watch(userProfileProvider).when(
  data: (profile) => Text(profile.name),
  loading: () => const CircularProgressIndicator(),
  error: (err, stack) => Text('Error: $err'),
);

The cost is a steeper learning curve (understanding the different provider families, ref.watch vs ref.read vs ref.listen, invalidation and autoDispose) and a code-generation tool (riverpod_generator) commonly used in practice to cut down annotation boilerplate, which adds a build step.

Bloc: architectural discipline, at the cost of boilerplate

Bloc enforces a strict pattern: every state change is triggered by an explicit "event," handled by the bloc, which emits a new state. This discipline (inspired by Redux/Flux architectures) makes the data flow fully traceable and unidirectional, which is valuable on multi-developer teams where you want to be able to re-read any state change without having to guess where it originated.

// cart_event.dart
abstract class CartEvent {}
class AddItemEvent extends CartEvent {
  final CartItem item;
  AddItemEvent(this.item);
}

// cart_state.dart
abstract class CartState {}
class CartInitial extends CartState {}
class CartUpdated extends CartState {
  final List<CartItem> items;
  CartUpdated(this.items);
}

// cart_bloc.dart
class CartBloc extends Bloc<CartEvent, CartState> {
  CartBloc() : super(CartInitial()) {
    on<AddItemEvent>((event, emit) {
      final current = state is CartUpdated ? (state as CartUpdated).items : <CartItem>[];
      emit(CartUpdated([...current, event.item]));
    });
  }
}

// in the widget
BlocBuilder<CartBloc, CartState>(
  builder: (context, state) {
    if (state is CartUpdated) {
      return Text('${state.items.length} items');
    }
    return const Text('Cart is empty');
  },
);

Testability is excellent out of the box: the bloc_test package lets you assert the exact sequence of states emitted in response to a sequence of events, without mounting a single widget. That's a real asset for a team that wants to enforce strict test coverage on business logic. The price is a much larger number of files and classes than Provider or Riverpod for an equivalent use case, which can feel disproportionate on something as simple as a login form.

Error handling under the hood: where each approach diverges

A detail that only shows up once an app talks to a real, occasionally failing network is how naturally each solution surfaces errors versus swallowing them. With bare ChangeNotifier in Provider, an exception thrown inside an async method that isn't awaited by the caller (a fire-and-forget addItem that does a background sync call) disappears into an unhandled future unless it's wrapped explicitly in a try/catch with its own error state field, which is easy to forget on any individual method:

class CartModel extends ChangeNotifier {
  String? error;

  Future<void> syncWithServer() async {
    try {
      await api.syncCart(_items);
      error = null;
    } catch (e) {
      error = 'Could not sync cart: $e';
    } finally {
      notifyListeners();
    }
  }
}

Riverpod's AsyncValue makes this the default rather than something each developer has to remember: any provider returning a Future that throws is automatically represented as AsyncValue.error, and .when() forces the call site to handle it, which tends to catch missing error handling at compile/review time rather than in production logs. Bloc sits in between: nothing forces error handling by default, but the convention of modeling failure as an explicit state (CartError, CartLoadFailure) alongside CartLoading and CartLoaded is strong enough in the ecosystem that most Bloc codebases end up with that discipline anyway, enforced by code review rather than the type system.

A realistic migration path

Teams rarely pick one solution and keep the whole app on it forever; a more common trajectory is starting a new feature with Provider for speed, then promoting it to Riverpod once it grows a second or third dependent async call. Because Riverpod's provider graph and Provider's ChangeNotifierProvider are conceptually similar, that specific migration tends to be localized to the screens actually affected:

// Before: Provider
class SearchModel extends ChangeNotifier {
  List<Product> results = [];
  Future<void> search(String query) async {
    results = await api.search(query);
    notifyListeners();
  }
}

// After: Riverpod, same responsibility, explicit async state
final searchQueryProvider = StateProvider<String>((ref) => '');

final searchResultsProvider = FutureProvider<List<Product>>((ref) async {
  final query = ref.watch(searchQueryProvider);
  if (query.isEmpty) return [];
  return ref.watch(apiClientProvider).search(query);
});

The Riverpod version gains something the Provider version didn't have for free: typing a new character into the search box automatically invalidates and re-runs searchResultsProvider because it watches searchQueryProvider, without any manual wiring to cancel the previous request's effect on notifyListeners(). Migrating from Bloc to Riverpod or the reverse is a heavier undertaking, since the two model state transitions with fundamentally different primitives (events/streams versus dependency graphs), which is itself an argument for picking deliberately up front rather than treating the first choice as free to reverse later.

The real decision criteria

The choice shouldn't be made on "project size" in the abstract, but on three concrete questions:

  1. How many concurrent async flows does each screen need to manage? If the answer is "many, with dependencies between them" (a search flow that depends on a filters flow that depends on geolocation), Riverpod handles that composition natively through ref.watch across providers, with no extra plumbing code.
  2. Does the team need an enforced structure to stay consistent over time? If the team is large, rotates, or the project needs to stay maintainable by junior developers joining later, Bloc's rigidity (one single place to look for "how does this state change") becomes an asset rather than a constraint.
  3. What's the real migration cost if the initial choice stops being enough? Provider is often a reasonable starting point for an MVP, but migrating to Riverpod or Bloc later means touching every screen that consumes that state; that cost should be budgeted upfront if the project is expected to grow.

When none of the three is enough on its own

On applications with complex offline-first business logic (deferred synchronization, conflict resolution, persistent local caching), state management alone (whichever one you pick) doesn't solve the problem. That requires a dedicated persistence layer (Drift/SQLite, Isar) with explicit synchronization logic, and the choice between Provider/Riverpod/Bloc only ends up exposing state already resolved by that layer to the widgets, not carrying the synchronization logic itself.

Takeaway

Provider fits an MVP or a small app without complex async flows; Riverpod brings testability outside the widget tree and clean composition of async dependencies, at the cost of a real learning curve; Bloc enforces an event/state discipline that pays off on a large team but adds overhead on a simple screen. Decide based on the actual async flows involved and the team discipline you need, not on an oversimplified project-size rule.