stateAsync property

  1. @override
Future<T> get stateAsync
override

The current Async state

Implementation

@override
Future<T> get stateAsync async {
  initialize();
  await completer?.future;
  if (_snapState.hasError) {
    final completer = Completer<T>();
    completer.completeError(
      _snapState.snapError!.error,
      _snapState.snapError!.stackTrace,
    );
    return completer.future;
  }
  return state;
}
  1. @override
set stateAsync (Future<T> value)
override

Async state mutation.

User setState for mor options

See: state for sync state mutation

Implementation

@override
set stateAsync(Future<T> value) {
  if (!isInitialized) {
    removeFromReactiveModel = addToActiveReactiveModels(this);
    isInitialized = true;
  }
  setStateNullable(
    (_) => value,
    middleSetState: middleSetState,
    stackTrace: kDebugMode ? StackTrace.current : null,
  );
}