ReducerClass<State> class abstract

Defines a Reducer using a class interface.

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

For some use cases, a class may be preferred to a function. In these instances, a ReducerClass can be used.

Example

class CounterReducer extends ReducerClass<int> {
  int call(int state, action) {
    switch (action) {
      case 'INCREMENT':
        return state + 1;
      case 'DECREMENT':
        return state - 1;
      default:
        return state;
    }
  }
}

final store = new Store<int>(new CounterReducer());
Implementers

Constructors

ReducerClass()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(State state, dynamic action) → State
The Reducer function that converts the current state and action into a new state
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited