middleSetCreator method
Implementation
void middleSetCreator(StateStatus status, Object? result) {
if (status == StateStatus.isWaiting) {
isWaitingToInitialize = true;
setToIsWaiting();
return;
}
if (status == StateStatus.hasError) {
assert(result is SnapError);
if (isWaitingToInitialize) {
setToHasError(
(result as SnapError).error,
stackTrace: result.stackTrace,
refresher: result.refresher,
);
} else {
_snapState = _snapState._copyToHasError(result as SnapError);
}
return;
}
if (isWaitingToInitialize) {
setToHasData(result);
} else {
_snapState = _snapState.copyToIsIdle(data: result, infoMessage: '');
}
}