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
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
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