AsyncData<T> class final

Represents the data state of an async operation.

Inheritance

Constructors

AsyncData(T value)
const

Properties

dataOrNull → T?
The data value, or null if not in data state.
no setterinherited
errorOrNull Object?
The error, or null if not in error state.
no setterinherited
hasData bool
Whether this state has data.
no setterinherited
hasError bool
Whether this state has an error.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
isLoading bool
Whether this state represents loading.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTraceOrNull StackTrace?
The stack trace, or null if not in error state.
no setterinherited
value → T
The successfully loaded data.
final

Methods

maybeWhen<R>({R loading()?, R data(T value)?, R onError(Object error, StackTrace? stackTrace)?, required R orElse()}) → R
Maps this state with optional fallback for unhandled states.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
when<R>({required R loading(), required R data(T value), required R onError(Object error, StackTrace? stackTrace)}) → R
Maps this state to a value using the provided callbacks.
inherited

Operators

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