ResourceExtensions<T> extension
Some useful extension available on any ResourceState.
- on
Properties
-
asError
→ ResourceError<
T> ? -
Available on ResourceState<
Upcast ResourceState into a ResourceError, or return null if the ResourceState is in ready/loading state.T> , provided by the ResourceExtensions extensionno setter -
asReady
→ ResourceReady<
T> ? -
Available on ResourceState<
Upcast ResourceState into a ResourceReady, or return null if the ResourceState is in loading/error state.T> , provided by the ResourceExtensions extensionno setter - error → Object?
-
Available on ResourceState<
Attempts to synchronously get the error of ResourceError.T> , provided by the ResourceExtensions extensionno setter - hasError → bool
-
Available on ResourceState<
Indicates if the resource has an error.T> , provided by the ResourceExtensions extensionno setter - isLoading → bool
-
Available on ResourceState<
Indicates if the resource is loading.T> , provided by the ResourceExtensions extensionno setter - isReady → bool
-
Available on ResourceState<
Indicates if the resource is ready.T> , provided by the ResourceExtensions extensionno setter - isRefreshing → bool
-
Available on ResourceState<
Indicates if the resource is refreshing. Loading is not considered as refreshing.T> , provided by the ResourceExtensions extensionno setter - value → T?
-
Available on ResourceState<
Attempts to synchronously get the value of ResourceReady.T> , provided by the ResourceExtensions extensionno 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<
Perform some actions based on the state of the ResourceState, or call orElse if the current state is not considered.T> , provided by the ResourceExtensions extension -
maybeOn<
R> ({required R orElse(), R ready(T data)?, R error(Object error, StackTrace? stackTrace)?, R loading()?}) → R -
Available on ResourceState<
Performs an action based on the state of the ResourceState, or callT> , provided by the ResourceExtensions extensionorElseif 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<
Performs an action based on the state of the ResourceState, or callT> , provided by the ResourceExtensions extensionorElseif 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<
Performs an action based on the state of the ResourceState.T> , provided by the ResourceExtensions extension -
when<
R> ({required R ready(T data), required R error(Object error, StackTrace? stackTrace), required R loading()}) → R -
Available on ResourceState<
Performs an action based on the state of the ResourceState.T> , provided by the ResourceExtensions extension