redux_compact
0.3.1, released 5 years ago by konstant.is
Redux extension to reduce boilerplate with compact actions and inline reducers.
What it does
Redux Compact reduces boilerplate for Flutter Redux applications by combining actions and reducers into a single CompactAction class. It supports both synchronous and asynchronous actions with direct access to state and dispatch functions.
AI-written summary of version 0.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a Flutter app using Redux and want to eliminate separate files for actions and reducers.
- You need to handle asynchronous requests cleanly inside a Redux action.
Skip it when
- you are not using Redux in your Flutter application.
- You prefer modern state management solutions like Riverpod or Bloc.
Strengths
- Eliminates separate action and reducer boilerplate files.
- Built-in support for asynchronous requests and request statuses.
- Action chaining capabilities with before and after hooks.
Weaknesses
- Tightly coupled to the Redux architecture.
- Mixing business logic and state reduction inside action classes can lead to large files if not structured carefully.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add compactReducer and compactMiddleware to your Redux Store.
final compactReducer = ReduxCompact.createReducer<AppState>();
final compactMiddleware = ReduxCompact.createMiddleware<AppState>();
final store = new Store<AppState>(
compactReducer,
initialState: AppState.initialState(),
middleware: [
compactMiddleware,
],
);Alternatives
Packages that do the same job and could replace redux_compact.
- bloc
A predictable state management library that helps separate business logic from UI using events and states.
92Compare - riverpod
A robust, compile-safe reactive caching and data-binding framework for Flutter.
99Compare - provider
A simpler dependency injection and state management inherited widget wrapper.
81Compare
Works with
Packages commonly used together with redux_compact: ones it builds on, ones built on it, and its own family.