Skip to content
pubscout

redux

5.0.0, released 6 years ago by fluttercommunity.dev

Predictable state container for Dart and Flutter using Redux pattern.

Flutter FavoriteWASM-ready
$ flutter pub add redux
Source repository

What it does

Provides a Store, reducers, and middleware to manage immutable app state in a unidirectional data flow. Works with any Dart code and can be combined with Flutter via flutter_redux.

AI-written summary of version 5.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a single source of truth with explicit state transitions
  • You want time‑travel debugging or easy state persistence
  • Your app benefits from middleware for logging, async, or side‑effects

Skip it when

  • You prefer a more lightweight solution like Provider
  • You need built‑in dependency injection or code‑generated models

Strengths

  • Clear, testable architecture
  • Supports middleware, dev tools, and time‑travel debugging
  • Works on all Flutter platforms

Weaknesses

  • More boilerplate than simple state solutions
  • Steep learning curve for newcomers
  • No built‑in DI or code generation

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
0

Add redux to pubspec, then create Store, reducers, and optionally use flutter_redux for UI binding

import 'package:redux/redux.dart';

enum Actions {increment, decrement}

int counterReducer(int state, action) =>
    action == Actions.increment ? state + 1 :
    action == Actions.decrement ? state - 1 : state;

void main() {
  final store = Store<int>(counterReducer, initialState: 0);
  store.dispatch(Actions.increment);
  print(store.state); // 1
}

Alternatives

Packages that do the same job and could replace redux.

  • bloc

    Offers similar unidirectional flow with built‑in event/state separation and less boilerplate

  • provider

    Simpler API for small apps, integrates directly with Flutter widget tree

  • riverpod

    Modern, compile‑time safety and flexible provider system without boilerplate

Works with

Packages commonly used together with redux: ones it builds on, ones built on it, and its own family.