QueryState<T> class
final
Immutable state of one query cache entry.
Constructors
- QueryState({required QueryStatus status, required QueryFetchStatus fetchStatus, required bool hasData, required T? data, required DateTime? dataUpdatedAt, required Object? error, required StackTrace? errorStackTrace, required DateTime? errorUpdatedAt, required int dataUpdateCount, required int errorUpdateCount, required int fetchFailureCount, required Object? fetchFailureReason, required bool isInvalidated, required Object? fetchMeta})
-
Creates a complete immutable query state.
const
- QueryState.pending()
-
Creates the initial state before data has been fetched.
factory
Properties
- data → T?
-
The last successful data value.
final
- dataUpdateCount → int
-
Number of successful data updates.
final
- dataUpdatedAt → DateTime?
-
When data was last updated.
final
- error → Object?
-
The latest fetch error.
final
- errorStackTrace → StackTrace?
-
The stack trace associated with error.
final
- errorUpdateCount → int
-
Number of error updates.
final
- errorUpdatedAt → DateTime?
-
When error was recorded.
final
- fetchFailureCount → int
-
Consecutive failures in the current fetch.
final
- fetchFailureReason → Object?
-
The latest failure that may still be retried.
final
- fetchMeta → Object?
-
Metadata associated with the current fetch.
final
- fetchStatus → QueryFetchStatus
-
The current fetch activity.
final
- hasData → bool
-
Whether data is present, including a present nullable value.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInvalidated → bool
-
Whether the cached data was explicitly invalidated.
final
- requireData → T
-
Returns the stored data or throws when no data is present.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → QueryStatus
-
The data lifecycle status.
final
Methods
-
copyWith(
{QueryStatus? status, QueryFetchStatus? fetchStatus, bool? hasData, Object? data = _unset, Object? dataUpdatedAt = _unset, Object? error = _unset, Object? errorStackTrace = _unset, Object? errorUpdatedAt = _unset, int? dataUpdateCount, int? errorUpdateCount, int? fetchFailureCount, Object? fetchFailureReason = _unset, bool? isInvalidated, Object? fetchMeta = _unset}) → QueryState< T> - Returns a state with the selected values replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited