registerState method
Implementation
void registerState(StateBase reducer) {
if (_store.value.containsKey(reducer.runtimeType)) {
return;
}
final ns = _newState();
ns[reducer.runtimeType] = reducer.initialState;
_store.add(ns);
void emitState(dynamic state) {
if (_store.value[reducer.runtimeType] != state) {
final ns = _newState();
ns[reducer.runtimeType] = state;
_store.add(ns);
}
}
_subscriptions[reducer.runtimeType] = _dispatcher.listen((action) {
reducer.mapActionToState(
_store.value[reducer.runtimeType], action, emitState, this);
});
dispatch(RegisterStateAction('${reducer.runtimeType}'));
}