Reducer<State> typedef

Reducer<State> = State Function(State state, 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);