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<
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 - hashCode → int
-
The hash code for this object.
no setteroverride
- 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
-
Indicates if the data is being refreshed, defaults to false.
final
- isRefreshing → bool
-
Available on ResourceState<
Indicates if the resource is refreshing. Loading is not considered as refreshing.T> , provided by the ResourceExtensions extensionno 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<
Attempts to synchronously get the value of ResourceReady.T> , provided by the ResourceExtensions extensionno 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
mapmethod 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<
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. -
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<
Performs an action based on the state of the ResourceState.T> , provided by the ResourceExtensions extension -
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<
Performs an action based on the state of the ResourceState.T> , provided by the ResourceExtensions extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override