SideEffects<T> constructor
SideEffects<T> ({
- void initState()?,
- void dispose()?,
- void onSetState(
- SnapState<
T>
- SnapState<
- VoidCallback? onAfterBuild,
Side effect to be called when the state is initialized, mutated and disposed of
See named constructor SideEffects.onData, SideEffects.onError, SideEffects.onWaiting SideEffects.onAll, and SideEffects.onOrElse
Implementation
SideEffects({
this.initState,
this.dispose,
this.onSetState,
VoidCallback? onAfterBuild,
}) {
if (onAfterBuild != null) {
_onAfterBuild =
([bool? isDisposed]) => WidgetsBinding.instance.addPostFrameCallback(
(_) {
if (isDisposed != true) {
onAfterBuild();
}
},
);
}
}