ResourceReady<T> class

Creates an ResourceState in ready state with a data.

Implemented types
Available extensions
Annotations
  • @immutable

Constructors

ResourceReady(T value, {bool isRefreshing = false})
Creates an ResourceState with a data.
const

Properties

asError ResourceError<T>?

Available on ResourceState<T>, provided by the ResourceExtensions extension

Upcast ResourceState into a ResourceError, or return null if the ResourceState is in ready/loading state.
no setter
asReady ResourceReady<T>?

Available on ResourceState<T>, provided by the ResourceExtensions extension

Upcast ResourceState into a ResourceReady, or return null if the ResourceState is in loading/error state.
no setter
error Object?

Available on ResourceState<T>, provided by the ResourceExtensions extension

Attempts to synchronously get the error of ResourceError.
no setter
hasError bool

Available on ResourceState<T>, provided by the ResourceExtensions extension

Indicates if the resource has an error.
no setter
hashCode int
The hash code for this object.
no setteroverride
isLoading bool

Available on ResourceState<T>, provided by the ResourceExtensions extension

Indicates if the resource is loading.
no setter
isReady bool

Available on ResourceState<T>, provided by the ResourceExtensions extension

Indicates if the resource is ready.
no setter
isRefreshing bool
Indicates if the data is being refreshed, defaults to false.
final
isRefreshing bool

Available on ResourceState<T>, provided by the ResourceExtensions extension

Indicates if the resource is refreshing. Loading is not considered as refreshing.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
The value currently exposed.
final
value → T?

Available on ResourceState<T>, provided by the ResourceExtensions extension

Attempts to synchronously get the value of ResourceReady.
no setter

Methods

copyWith({T? value, bool? isRefreshing}) ResourceReady<T>
Convenience method to update the values of a ResourceReady.
map<R>({required R ready(ResourceReady<T> ready), required R error(ResourceError<T> error), required R loading(ResourceLoading<T> loading)}) → R
private mapper, so that classes inheriting Resource can specify their own map method with different parameters.
override
maybeMap<R>({required R orElse(), R ready(ResourceReady<T> ready)?, R error(ResourceError<T> error)?, R loading(ResourceLoading<T> loading)?}) → R

Available on ResourceState<T>, provided by the ResourceExtensions extension

Perform some actions based on the state of the ResourceState, or call orElse if the current state is not considered.
maybeOn<R>({required R orElse(), R ready(T data)?, R error(Object error, StackTrace? stackTrace)?, R loading()?}) → R

Available on ResourceState<T>, provided by the ResourceExtensions extension

Performs an action based on the state of the ResourceState, or call orElse if the current state is not considered.
maybeWhen<R>({required R orElse(), R ready(T data)?, R error(Object error, StackTrace? stackTrace)?, R loading()?}) → R

Available on ResourceState<T>, provided by the ResourceExtensions extension

Performs an action based on the state of the ResourceState, or call orElse if the current state is not considered.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<R>({required R ready(T data), required R error(Object error, StackTrace? stackTrace), required R loading()}) → R

Available on ResourceState<T>, provided by the ResourceExtensions extension

Performs an action based on the state of the ResourceState.
toString() String
A string representation of this object.
override
when<R>({required R ready(T data), required R error(Object error, StackTrace? stackTrace), required R loading()}) → R

Available on ResourceState<T>, provided by the ResourceExtensions extension

Performs an action based on the state of the ResourceState.

Operators

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