combine<COMBS, COMBE, COMBA extends ReducerAction> static method

Reducer<COMBS, COMBE, COMBA> combine<COMBS, COMBE, COMBA extends ReducerAction>(
  1. Reducer<COMBS, COMBE, COMBA> reducerA,
  2. Reducer<COMBS, COMBE, COMBA> reducerB
)

Implementation

static Reducer<COMBS, COMBE, COMBA>
    combine<COMBS, COMBE, COMBA extends ReducerAction>(
        Reducer<COMBS, COMBE, COMBA> reducerA,
        Reducer<COMBS, COMBE, COMBA> reducerB) {
  return Reducer((state, action) {
    final reducerTupleA = reducerA.run(state, action);
    final reducerTupleB = reducerB.run(reducerTupleA.state, action);
    return ReducerTuple(reducerTupleB.state,
        [...reducerTupleA.effectTasks, ...reducerTupleB.effectTasks]);
  });
}