ResourceExtensions<T> extension

Some useful extension available on any ResourceState.

on

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
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
value → T?

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

Attempts to synchronously get the value of ResourceReady.
no setter

Methods

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.
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.
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.