Reducer<State> typedef

State Reducer (
  1. State state,
  2. dynamic action
)

Defines an application's state change

Implement this typedef to modify your app state in response to a given action.

Example

int counterReducer(int state, action) {
  switch (action) {
    case 'INCREMENT':
      return state + 1;
    case 'DECREMENT':
      return state - 1;
    default:
      return state;
  }
}

final store = new Store<int>(counterReducer);

Implementation

typedef Reducer<State> = State Function(State state, dynamic action);