createDispatcherWith
void Function(P)
createDispatcherWith<
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));