Middleware<State> typedef

Middleware<State> = dynamic Function(Store<State> store, dynamic action, NextDispatcher next)

A function that intercepts actions and potentially transform actions before they reach the reducer.

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.


loggingMiddleware(Store<int> store, action, NextDispatcher next) {
  print('${new DateTime.now()}: $action');


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


typedef Middleware<State> = dynamic Function(
  Store<State> store,
  dynamic action,
  NextDispatcher next,