AsyncData<T> class
Creates an AsyncValue with a data.
- Inheritance
-
- Object
- AsyncValue<
T> - AsyncData
- Available extensions
Constructors
- AsyncData(T value)
-
Creates an AsyncValue with a data.
const
Properties
-
asData
→ AsyncData<
T> ? -
Available on AsyncValue<
Upcast AsyncValue into an AsyncData, or return null if the AsyncValue is an AsyncLoading/AsyncError.T> , provided by the AsyncValueX extensionno setter -
asError
→ AsyncError<
T> ? -
Available on AsyncValue<
Upcast AsyncValue into an AsyncError, or return null if the AsyncValue is an AsyncLoading/AsyncData.T> , provided by the AsyncValueX extensionno setter - error → Object?
-
The error.
final
- hasError → bool
-
Available on AsyncValue<
Whether error is not null.T> , provided by the AsyncValueX extensionno setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasValue → bool
-
Whether value is set.
no setteroverride
- isLoading → bool
-
Whether some new value is currently asynchronously loading.
final
- isRefreshing → bool
-
Available on AsyncValue<
Whether the associated provider was forced to recompute even though none of its dependencies has changed, after at least one value/error was emitted.T> , provided by the AsyncValueX extensionno setter - isReloading → bool
-
Available on AsyncValue<
Whether the associated provider was recomputed because of a dependency change (using Ref.watch), after at least one value/error was emitted.T> , provided by the AsyncValueX extensionno setter - requireValue → T
-
Available on AsyncValue<
If hasValue is true, returns the value. Otherwise if hasError, rethrows the error. Finally if in loading state, throws a StateError.T> , provided by the AsyncValueX extensionno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stacktrace of error.
final
- value → T
-
The value currently exposed.
final
- valueOrNull → T?
-
Available on AsyncValue<
Return the value or previous value if in loading/error state.T> , provided by the AsyncValueX extensionno setter
Methods
-
copyWithPrevious(
AsyncValue< T> previous, {bool isRefresh = true}) → AsyncData<T> -
Clone an AsyncValue, merging it with
previous
.override -
map<
R> ({required R data(AsyncData< T> data), required R error(AsyncError<T> error), required R loading(AsyncLoading<T> loading)}) → R -
Perform some action based on the current state of the AsyncValue.
override
-
mapOrNull<
R> ({R? data(AsyncData< T> data)?, R? error(AsyncError<T> error)?, R? loading(AsyncLoading<T> loading)?}) → R? -
Available on AsyncValue<
Perform some actions based on the state of the AsyncValue, or return null if the current state wasn't tested.T> , provided by the AsyncValueX extension -
maybeMap<
R> ({R data(AsyncData< T> data)?, R error(AsyncError<T> error)?, R loading(AsyncLoading<T> loading)?, required R orElse()}) → R -
Available on AsyncValue<
Perform some actions based on the state of the AsyncValue, or call orElse if the current state was not tested.T> , provided by the AsyncValueX extension -
maybeWhen<
R> ({bool skipLoadingOnReload = false, bool skipLoadingOnRefresh = true, bool skipError = false, R data(T data)?, R error(Object error, StackTrace stackTrace)?, R loading()?, required R orElse()}) → R -
Available on AsyncValue<
Switch-case over the state of the AsyncValue while purposefully not handling some cases.T> , provided by the AsyncValueX extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unwrapPrevious(
) → AsyncValue< T> -
The opposite of copyWithPrevious, reverting to the raw AsyncValue
with no information on the previous state.
inherited
-
when<
R> ({bool skipLoadingOnReload = false, bool skipLoadingOnRefresh = true, bool skipError = false, required R data(T data), required R error(Object error, StackTrace stackTrace), required R loading()}) → R -
Available on AsyncValue<
Performs an action based on the state of the AsyncValue.T> , provided by the AsyncValueX extension -
whenData<
R> (R cb(T value)) → AsyncValue< R> -
Available on AsyncValue<
Shorthand for when to handle only theT> , provided by the AsyncValueX extensiondata
case. -
whenOrNull<
R> ({bool skipLoadingOnReload = false, bool skipLoadingOnRefresh = true, bool skipError = false, R? data(T data)?, R? error(Object error, StackTrace stackTrace)?, R? loading()?}) → R? -
Available on AsyncValue<
Perform actions conditionally based on the state of the AsyncValue.T> , provided by the AsyncValueX extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited