ResourceData<T> class
Data state - data was successfully loaded.
- Inheritance
-
- Object
- ResourceState<
T> - ResourceData
Constructors
- ResourceData({required T data, bool fromCache = false, DateTime? fetchedAt})
Properties
- data → T
-
The fetched data.
final
- dataOrNull → T?
-
Gets the data if available, or null.
no setterinherited
- errorOrNull → FKernalError?
-
Gets the error if present, or null.
no setterinherited
- fetchedAt → DateTime
-
When the data was fetched.
final
- fromCache → bool
-
Whether the data came from cache.
final
- hasData → bool
-
Whether data has been loaded successfully.
no setterinherited
- hasError → bool
-
Whether an error occurred.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLoading → bool
-
Whether data is currently loading.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
maybeWhen<
R> ({R loading()?, R onData(T data)?, R onError(FKernalError error)?, R initial()?, R orElse()?}) → R? -
Maps the state, with optional handlers (returns null for unhandled cases).
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
R> ({required R loading(), required R onData(T data), required R onError(FKernalError error), R initial()?}) → R -
Maps the state to a value using the provided functions.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited