useDispatch<S> function
A hook to access the redux dispatch
function
Example
class StoreUser extends HookWidget {
@override
Widget build(BuildContext context) {
final dispatch = useDispatch<AppState>();
useEffect(() {
dispatch(SomeAction());
}, []);
return YourWidgetHierarchy(dispatch: dispatch);
}
}
Implementation
Dispatch useDispatch<S>() => useStore<S>().dispatch;