ReduxReducer<Parent, ClassType> class abstract

Every Reducer has to extend this class

class ShopReducer extends ReduxReducer<AppState, Shop> {
  static Map<Type, ReducerFunction<AppState, dynamic>> _reducers = {
    UpdateShopNameAction: (shop, action) => shop..name = action.value,
  }

  ShopReducer()
      : super(
    getter: (appState) => appState.shop,
    setter: (appState, value) => appState..shop = value,
    reducers: _reducers,
    children: [
      AddressReducer<Shop>(
            (shop) => shop.address,
            (shop, address) => shop..address = address,
      ),
    ],
  );
}

Constructors

ReduxReducer({required GetterFunction<Parent, ClassType> getter, required SetterFunction<Parent, ClassType> setter, required List<ActionReducer<ClassType, dynamic, dynamic>> reducers, List<ReduxReducer<ClassType, dynamic>> children = const []})

Properties

children List<ReduxReducer<ClassType, dynamic>>
getter/setter pair
getter GetterFunction<Parent, ClassType>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
reducers List<ActionReducer<ClassType, dynamic, dynamic>>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setter SetterFunction<Parent, ClassType>
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(Parent parentState, ReduxAction action) → Parent?
Retrieves the fitting reducer for the ReduxAction supplied, executes it and returns the Parent or null if no ReducerFunction was found in its reducers or within its children The first ReducerFunction that is found is used and the result returned immediately. You should never have multiple ReducerFunctions defined for any ReduxAction!
reduceRoot(Parent parentState, ReduxAction action) → Parent
toString() String
A string representation of this object.
inherited

Operators

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