FutureReducer<State, Action, Payload> constructor
FutureReducer<State, Action, Payload> ({
- required State successReducer(
- State,
- FutureSucceededAction<
Action, Payload>
- State pendingReducer(
- State,
- FuturePendingAction<
Action>
- State failedReducer(
- State,
- FutureFailedAction<
Action>
Creates a Reducer
which handles the success
, pending
and failed
state of the Future passed to the FutureMiddleware
.
The successReducer
must not be null.
If pendingReducer
or failedReducer
is not passsed, then it defaults
to FutureReducerDefaults.pendingReducer or FutureReducerDefaults.failedReducer.
Implementation
factory FutureReducer({
required State Function(State, FutureSucceededAction<Action, Payload>)
successReducer,
State Function(State, FuturePendingAction<Action>)? pendingReducer,
State Function(State, FutureFailedAction<Action>)? failedReducer,
}) {
return FutureReducer._(
successReducer: successReducer,
pendingReducer: pendingReducer ??
((State state, FuturePendingAction<Action> action) =>
FutureReducerDefaults.pendingReducer(state, action)),
failedReducer: failedReducer ??
((State state, FutureFailedAction<Action> action) =>
FutureReducerDefaults.failedReducer(state, action)),
);
}