flutter_redux
0.10.0, released 5 years ago by brianegan.com
Utility widgets that connect Flutter applications to a Redux store.
What it does
Provides StoreProvider, StoreBuilder, and StoreConnector widgets to easily supply a Redux store down the widget tree, build UI from state, and automatically rebuild when state changes.
AI-written summary of version 0.10.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building an app with complex state logic and want to use Redux for state management.
- You want your widgets to automatically rebuild when relevant parts of the Redux store change without manually managing subscriptions.
Skip it when
- You are building a simple app where a StatefulWidget is sufficient.
- You prefer modern Flutter state management alternatives like Riverpod or Bloc.
Strengths
- Separates business logic cleanly from UI code.
- Automatic subscription handling and widget rebuilding via StoreConnector.
- Well-tested and structured around the Redux.dart ecosystem.
Weaknesses
- Requires boilerplate code typical of Redux patterns.
- Older architecture compared to newer state management options.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add dependencies to pubspec.yaml and wrap your application in a StoreProvider.
final store = Store<int>(counterReducer, initialState: 0);
StoreProvider<int>(
store: store,
child: MaterialApp(
home: Scaffold(
body: StoreConnector<int, String>(
converter: (store) => store.state.toString(),
builder: (context, count) {
return Text('Count: $count');
},
),
),
),
);Alternatives
Packages that do the same job and could replace flutter_redux.
- flutter_bloc
Provides a predictable state management solution using the BLoC pattern, which is more commonly used in modern Flutter apps.
86Compare - riverpod
Offers a compile-safe, robust, and modern dependency injection and state management solution.
99Compare
Works with
Packages commonly used together with flutter_redux: ones it builds on, ones built on it, and its own family.