AsyncData<T> class

A class that represents a value that is loaded asynchronously.

Inheritance

Constructors

AsyncData(T value)
Creates an instance of AsyncData.

Properties

hashCode int
The hash code for this object.
no setteroverride
isData bool
Returns true if this is AsyncData.
no setteroverride
isError bool
Returns true if this is AsyncError.
no setterinherited
isIdle bool
Returns true if this is AsyncIdle.
no setterinherited
isIdleOrLoading bool
Returns true if this is AsyncIdle or AsyncLoading.
no setterinherited
isLoading bool
Returns true if this is AsyncLoading.
no setterinherited
lastData → T?
Returns the last data that was successfully loaded This is useful when the current state is AsyncError or AsyncLoading
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
The value that was loaded.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setLastData(T? value) → void
This is useful when manually hanlding async state and you want to keep track of the last successful data. You can use the lastData getter to retrieve the last successful data when in AsyncError or AsyncLoading state.
inherited
toString() String
A string representation of this object.
override
unwrap() → T
Casts this AsyncValue to AsyncData and return it's value or throws CastError if this is not AsyncData.
override
unwrapOrNull() → T?
If this is AsyncData, returns it's value. Otherwise returns null.
override

Operators

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