middleSetState method
dynamic
middleSetState(
- StateStatus status,
- Object? result, {
- SideEffects<
T> ? sideEffects, - StateInterceptor<
T> ? stateInterceptor, - bool shouldOverrideDefaultSideEffects(
- SnapState<
T>
- SnapState<
Implementation
middleSetState(
StateStatus status,
Object? result, {
SideEffects<T>? sideEffects,
StateInterceptor<T>? stateInterceptor,
bool Function(SnapState<T>)? shouldOverrideDefaultSideEffects,
}) {
if (status == StateStatus.isWaiting) {
setToIsWaiting(
sideEffects: sideEffects,
shouldOverrideDefaultSideEffects: shouldOverrideDefaultSideEffects,
stateInterceptor: stateInterceptor,
);
return;
}
if (status == StateStatus.hasError) {
assert(result is SnapError);
setToHasError(
(result as SnapError).error,
stackTrace: result.stackTrace,
refresher: result.refresher,
sideEffects: sideEffects,
shouldOverrideDefaultSideEffects: shouldOverrideDefaultSideEffects,
stateInterceptor: stateInterceptor,
);
return;
}
setToHasData(
result,
sideEffects: sideEffects,
shouldOverrideDefaultSideEffects: shouldOverrideDefaultSideEffects,
stateInterceptor: stateInterceptor,
);
}