AsyncLoading<T> class

The loading state of an AsyncValue.

Optionally carries the previousData from the last successful load, enabling optimistic UI patterns (e.g. showing stale data with a loading indicator).

Inheritance

Constructors

AsyncLoading([T? previousData])
Creates an AsyncLoading, optionally preserving previousData.
const

Properties

hasData → bool
Whether this value holds successful data.
no setterinherited
hasError → bool
Whether this value represents a failed operation.
no setterinherited
hashCode → int
The hash code for this object.
no setteroverride
hasValue → bool
Alias for whether valueOrNull is non-null.
no setterinherited
isLoading → bool
Whether this value is currently loading.
no setterinherited
previousData → T?
The data value from the previous successful load, if any.
final
requireValue → T
Returns the current value, throwing a StateError if no data is available.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → T?
The most recent successful value, or null if no data has arrived yet.
no setterinherited

Methods

maybeWhen<R>({R data(T data)?, R loading(T? previousData)?, R error(Object error, StackTrace stackTrace)?, required R orElse()}) → R
Pattern-matches with an orElse 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 data(T data), required R loading(T? previousData), required R error(Object error, StackTrace stackTrace)}) → R
Exhaustively pattern-matches all three async states.
inherited
whenOrNull<R>({R data(T data)?, R loading(T? previousData)?, R error(Object error, StackTrace stackTrace)?}) → R?
Pattern-matches and returns null for unhandled states.
inherited

Operators

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