redux_heaven 0.1.0 redux_heaven: ^0.1.0 copied to clipboard
A collection of utilities for development with Redux.
redux_heaven #
A package of simple utilities for development with Redux.
It helps you write Redux boilerplate comfortably & cleanly.
This package is fully inspired from Redux.dart.
This package is ported from another own packages redux_types & injectable_middleware.
ReducerOf
& MiddlewareOf
#
These are more cleaned type matching classes for Redux than TypedReducer
& TypedMiddleware
of Redux.dart. You can comfortably write type matching classes with IDE support like Android Studio.
ReducerOf
- A Reducer class for type matching. It's better to write & read with IDE support.MiddlewareOf
- A Middleware class for type matching. It's better to write & read with IDE support.
Dependencies #
- Dart 2.2.3+
- Redux.dart 4.0.0+.
Usage #
Demonstrate how to use redux_types
.
ReducerOf #
final Reducer<AppState> appReducer = combineReducers(
[
/// An example of using [ReducerOf]. It provides you
/// an ease of writing by IDE support and readability.
ReducerOf<AppState, IncrementAction>(
callback: (state, action) {
return state.copyWith(
counter: state.counter + 1,
);
},
),
],
);
MiddlewareOf #
List<Middleware<AppState>> counterMiddleware() {
return [
/// An example of using [MiddlewareOf]. It provides you
/// an ease of writing by IDE support and readability.
MiddlewareOf<AppState, IncrementAction>(
callback: (store, action, next) {
print('IncrementAction was called!');
next(action);
},
),
];
}