dimapOnState<Sn> method
Adapts this decider's state type in both directions.
fl: transforms incoming stateSntoSfr: transforms resulting stateStoSn
Implementation
Decider<C, Sn, E> dimapOnState<Sn>({
required S Function(Sn) fl,
required Sn Function(S) fr,
}) {
return Decider<C, Sn, E>(
decide: (command, state) => decide(command, fl(state)),
evolve: (state, event) => fr(evolve(fl(state), event)),
initialState: fr(initialState),
);
}