AsyncLoading<ValueT> class final Core

Creates an AsyncValue in loading state.

Prefer always using this constructor with the const keyword.

Inheritance
Available extensions
Annotations
  • @publicInRiverpodAndCodegen

Constructors

AsyncLoading.new({num? progress})
Creates an AsyncValue in loading state.
const

Properties

asData AsyncData<ValueT>?

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Upcast AsyncValue into an AsyncData, or return null if the AsyncValue is an AsyncLoading/AsyncError.
no setter
asError AsyncError<ValueT>?

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Upcast AsyncValue into an AsyncError, or return null if the AsyncValue is an AsyncLoading/AsyncData.
no setter
error Object?
The error.
no setterinherited
hasError bool

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Whether error is not null.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasValue bool

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Whether value is set.
no setter
isFromCache bool

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Whether the value was obtained using Riverpod's offline-persistence feature.
no setter
isLoading bool

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Whether some new value is currently asynchronously loading.
no setter
isRefreshing bool

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Whether the associated provider was forced to recompute even though none of its dependencies has changed, after at least one value/error was emitted.
no setter
isReloading bool

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Whether the associated provider was recomputed because of a dependency change (using Ref.watch), after at least one value/error was emitted.
no setter
progress num?

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

The current progress of the asynchronous operation.
no setter
requireValue → ValueT
If hasValue is true, returns the value. Otherwise if hasError, rethrows the error. Finally if in loading state, throws a StateError.
no setterinherited
retrying bool

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

If an error was emitted, whether that error is currently being retried.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace?
The stacktrace of error.
no setterinherited
value → ValueT?
The value currently exposed.
no setterinherited

Methods

map<NewT>({required NewT data(AsyncData<ValueT> data), required NewT error(AsyncError<ValueT> error), required NewT loading(AsyncLoading<ValueT> loading)}) → NewT

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Perform some action based on the current state of the AsyncValue.
mapOrNull<NewT>({NewT? data(AsyncData<ValueT> data)?, NewT? error(AsyncError<ValueT> error)?, NewT? loading(AsyncLoading<ValueT> loading)?}) → NewT?

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Perform some actions based on the state of the AsyncValue, or return null if the current state wasn't tested.
maybeMap<NewT>({NewT data(AsyncData<ValueT> data)?, NewT error(AsyncError<ValueT> error)?, NewT loading(AsyncLoading<ValueT> loading)?, required NewT orElse()}) → NewT

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Perform some actions based on the state of the AsyncValue, or call orElse if the current state was not tested.
maybeWhen<NewT>({bool skipLoadingOnReload = false, bool skipLoadingOnRefresh = true, bool skipError = false, NewT data(ValueT data)?, NewT error(Object error, StackTrace stackTrace)?, NewT loading()?, required NewT orElse()}) → NewT

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Switch-case over the state of the AsyncValue while purposefully not handling some cases.
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<ValueT>

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

The opposite of copyWithPrevious, reverting to the raw AsyncValue with no information on the previous state.
when<NewT>({bool skipLoadingOnReload = false, bool skipLoadingOnRefresh = true, bool skipError = false, required NewT data(ValueT data), required NewT error(Object error, StackTrace stackTrace), required NewT loading()}) → NewT

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Performs an action based on the state of the AsyncValue.
whenData<NewT>(NewT cb(ValueT value)) AsyncValue<NewT>

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Shorthand for when to handle only the data case.
whenOrNull<NewT>({bool skipLoadingOnReload = false, bool skipLoadingOnRefresh = true, bool skipError = false, NewT? data(ValueT data)?, NewT? error(Object error, StackTrace stackTrace)?, NewT? loading()?}) → NewT?

Available on AsyncValue<ValueT>, provided by the AsyncValueExtensions extension

Perform actions conditionally based on the state of the AsyncValue.

Operators

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