AsyncValue<T> class sealed

A sealed class that represents the state of an asynchronous operation.

Implementers

Constructors

AsyncValue.data(T value)
Creates a data state
const
factory
AsyncValue.error(Object error, [StackTrace? stackTrace])
Creates an error state
factory
AsyncValue.loading()
Creates a loading state
const
factory

Properties

errorOrNull Object?
Gets the error if in error state, null otherwise
no setter
hasData bool
Checks if the state has data
no setter
hasError bool
Checks if the state has an error
no setter
hashCode int
The hash code for this object.
no setterinherited
isLoading bool
Checks if the state is loading
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → T?
Gets the value if in data state, null otherwise
no setter

Methods

map<R>({required R loading(), required R error(Object error, StackTrace? stackTrace), required R data(T data)}) → R
Pattern matching method similar to Riverpod's AsyncValue.map
mapOrNull<R>({R loading()?, R error(Object error, StackTrace? stackTrace)?, R data(T data)?}) → R?
Pattern matching method that doesn't require all cases
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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