SideEffects<T> class

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

Constructors

SideEffects({void initState()?, void dispose()?, void onSetState(SnapState<T>)?, VoidCallback? onAfterBuild})
Side effect to be called when the state is initialized, mutated and disposed of
SideEffects.onAll({required void onWaiting()?, required void onError(dynamic err, VoidCallback refresh)?, required void onData(T data)?, void initState()?, void dispose()?})
Handle all possible for state status. Null argument will be ignored.
factory
SideEffects.onData(void data(T data), {void initState()?, void dispose()?})
Side effect to be called when he state is mutated successfully with data
factory
SideEffects.onError(void onError(dynamic err, VoidCallback refresh), {void initState()?, void dispose()?})
Side effect to be called when the state has error.
factory
SideEffects.onOrElse({void onWaiting()?, void onError(dynamic err, VoidCallback refresh)?, void onData(T data)?, required void orElse(T data), void initState()?, void dispose()?})
Handle the three state status with one required fallback callback.
factory
SideEffects.onWaiting(void onWaiting(), {void initState()?, void dispose()?})
Side effect to be called while waiting for the state to resolve
factory

Properties

dispose → void Function()?
Side effect to be called when the state is disposed of,
final
hashCode int
The hash code for this object.
no setterinherited
initState → void Function()?
Side effect to be called when the state is first initialized
final
onAfterBuild → void Function([bool? isDisposed])?
no setter
onSetState → void Function(SnapState<T>)?
Side effect to be called when the state is mutated
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited