Skip to content
Architecture
Architecture explorationIntermediate10 Aug 2026

BLoC or Riverpod: how I decide

A practical comparison based on the shape of the feature, not on which one is trending.

FlutterState managementBLoCRiverpod

Both work. Teams ship good apps with either. So the honest answer is not "BLoC is better". It is "what does this feature actually look like?"

Where BLoC earns its keep

BLoC is at its best when the feature is a state machine and you know it.

A checkout is a state machine. An order is a state machine. A multi-step form with validation and a payment at the end is a state machine. In those, the value of BLoC is that every change to the state has a name, and that name is an event you can read, log and test.

dart
sealed class CheckoutEvent {}
class AddressSubmitted extends CheckoutEvent { ... }
class PaymentStarted extends CheckoutEvent {}
class PaymentFailed extends CheckoutEvent { final String reason; ... }

Six months later, someone asks why an order ended up in a strange state. With events, you can answer that. With a pile of setters, you guess.

The cost is real: files, boilerplate, and a lot of ceremony for a screen that just loads a list.

Where Riverpod earns its keep

Riverpod is at its best for reading and composing data.

A list that comes from an API, a filter on top of it, a derived count in the app bar. That is three providers and no events. Riverpod also handles the boring parts well: caching, disposal, and depending on another provider without wiring anything by hand.

dart
final ordersProvider = FutureProvider((ref) => ref.watch(repoProvider).fetchOrders());
 
final pendingCountProvider = Provider((ref) =>
    ref.watch(ordersProvider).valueOrNull?.where((o) => o.isPending).length ?? 0);

Writing that in BLoC means a bloc, a bloc-to-bloc subscription and a lifecycle you now own.

My actual rule

I ask two questions.

Does this feature have transitions I would want to name? If yes, BLoC.

Is this feature mostly "fetch, show, derive"? If yes, Riverpod.

Most apps have both kinds of features. Mixing them in one codebase is fine as long as the rule for choosing is written down and everyone follows it. What is not fine is choosing per developer per sprint, which is how you end up with four patterns and no one able to read anyone else's screen.

What actually causes the pain

In my experience the state management library is rarely the reason a Flutter codebase gets hard to work with. The reasons are usually:

  • business rules living inside widgets
  • one god-state holding half the app
  • no boundary between UI and data, so every API change is a UI change
  • state that outlives the screen and nobody knows why

Fix those and both libraries feel fine. Skip them and both feel terrible.

The question to expect in an interview

"Why did you pick this one?" The wrong answer is "it is what the team uses" or "it is the most popular". A good answer names the shape of the feature and the trade-off you accepted. If you cannot do that, the choice was not really a choice.