createDispatcherWith

void Function(P) createDispatcherWith<A extends Action, P>(

  1. A actionCreator(
    1. P
    ),
  2. void dispatch(
    1. Action
    )
)

Creates a dispatcher function for an action with a parameter.

Example:

final dispatchSetValue = createDispatcherWith(
  (int v) => SetValue(v),
  store.dispatch,
);
dispatchSetValue(42); // dispatches SetValue(42)

Implementation

void Function(P) createDispatcherWith<A extends Action, P>(
  A Function(P) actionCreator,
  void Function(Action) dispatch,
) =>
    (param) => dispatch(actionCreator(param));