bindActionCreators
Map<
Binds multiple action creators to a dispatch function.
This turns a map of action creators into a map with the same keys, but with every action creator wrapped into a dispatch call.
Example:
final actionCreators = {
'increment': () => Increment(),
'decrement': () => Decrement(),
};
final bound = bindActionCreators(actionCreators, store.dispatch);
bound['increment']!(); // dispatches Increment
Implementation
Map<String, void Function()> bindActionCreators(
Map<String, Action Function()> actionCreators,
void Function(Action) dispatch,
) => actionCreators.map(
(key, creator) => MapEntry(key, () => dispatch(creator())),
);