dispatch method

void dispatch(
  1. A action
)

Dispatches action, synchronously computing and applying the next state via reducerFn.

The action is appended to history, and the returned state from reducerFn is assigned to state. All reactive listeners and Live boundaries observing state are notified synchronously.

reducer.dispatch(Increment(5));

Implementation

void dispatch(A action) {
  _history.add(action);
  _state.value = reducerFn(_state.value, action);
}