AsyncData<T> class
A class that represents a value that is loaded asynchronously.
- Inheritance
-
- Object
- AsyncValue<
T> - AsyncData
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isData → bool
-
Returns
trueif this is AsyncData.no setteroverride - isError → bool
-
Returns
trueif this is AsyncError.no setterinherited - isIdle → bool
-
Returns
trueif this is AsyncIdle.no setterinherited - isIdleOrLoading → bool
-
Returns
trueif this is AsyncIdle or AsyncLoading.no setterinherited - isLoading → bool
-
Returns
trueif 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
lastDatagetter 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
CastErrorif 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