ResourceLoading<T> class

Creates an ResourceState in loading state.

Prefer always using this constructor with the const keyword.

Implemented types
Available extensions
Annotations
  • @immutable

Constructors

ResourceLoading()
Creates an ResourceState in loading state.
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

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?

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

Attempts to synchronously get the value of ResourceReady.
no setter

Methods

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