registerMapper<Substate> method

void registerMapper<Substate>(
  1. MapperReader<State, Substate> reader,
  2. MapperWriter<State, Substate> writer
)

Registering a mapper that allows to dispatch StoreAction<Substate> actions.

The state parameter of this action is mapped from the state with the reader, and the resulting new state is created out of the writer which merges the new substate into the current state, and produces a new state.

Implementation

void registerMapper<Substate>(MapperReader<State, Substate> reader,
    MapperWriter<State, Substate> writer) {
  _mappers[Substate] = Mapper<State, Substate>(
    reader: reader,
    writer: writer,
  );
}