MiddlewareClass<State> class abstract

Defines a Middleware using a Class interface.

Middleware intercept actions before they reach the reducer. This gives them the ability to produce side-effects or modify the passed in action before they reach the reducer.

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

Example

class LoggingMiddleware extends MiddlewareClass<int> {
  call(Store<int> store, action, NextDispatcher next) {
    print('${new DateTime.now()}: $action');

    next(action);
  }
}

// Create your store with the loggingMiddleware
final store = new Store<int>(
  counterReducer,
  middleware: [new LoggingMiddleware()],
);
Implementers

Constructors

MiddlewareClass()

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(Store<State> store, dynamic action, NextDispatcher next) → dynamic
A Middleware function that intercepts a dispatched action
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