AsyncPhase<T extends Object?> class sealed

The base class for the classes that represent phases of an asynchronous operation.

Implementers
Annotations
  • @immutable

Constructors

AsyncPhase(T? data, {Object? error, StackTrace? stackTrace})
const

Properties

data → T?
The result of an asynchronous operation.
final
hashCode int
The hash code for this object.
no setteroverride
isComplete bool
Whether the phase is of type AsyncComplete.
no setter
isError bool
Whether the phase is of type AsyncError.
no setter
isInitial bool
Whether the phase is of type AsyncInitial.
no setter
isWaiting bool
Whether the phase is of type AsyncWaiting.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyAsWaiting() AsyncWaiting<T>
A method that creates an AsyncWaiting object based on the phase that this method is called on.
copyWith(T newData) AsyncPhase<T>
A method that copy a phase to create a new phase with new data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
when<U>({required U waiting(T?), required U complete(T), required U error(T?, Object?, StackTrace?), U initial(T?)?}) → U
A method that returns a value returned from one of callback functions corresponding to the current phase of an asynchronous operation.
whenOrNull<U>({U initial(T?)?, U waiting(T?)?, U complete(T)?, U error(T?, Object?, StackTrace?)?}) → U?
A method that returns a value returned from one of callback functions corresponding to the current phase of an asynchronous operation.

Operators

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

Static Methods

from<T extends Object?, S extends T?>(FutureOr<T> func(), {S? fallbackData, void onComplete(T)?, void onError(S?, Object, StackTrace)?}) Future<AsyncPhase<T>>
A method that runs an asynchronous function and returns either AsyncComplete with the function result as data or AsyncError with the error information, depending on whether or not the function completed successfully.