Query<T> class final

One asynchronous server-state machine stored by QueryCache.

Constructors

Query({required QueryClient client, required QueryCache cache, required ResolvedQueryOptions<T> options, QueryOptions<T>? sourceOptions, QueryState<T>? state})
Creates one query cache entry.

Properties

cache → QueryCache
The cache that stores this query.
final
client → QueryClient
The client that owns this query.
final
dataType → Type
Exact data type stored by this query.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isActive → bool
Whether any observer permits automatic fetching.
no setter
isDisabled → bool
Whether this query currently has no active observer.
no setter
isFetching → bool
Whether a fetch is active.
no setter
isStatic → bool
Whether every observer treats this query as immutable.
no setter
key → QueryKey<T>
The query's cache key.
no setter
options ↔ ResolvedQueryOptions<T>
The resolved runtime options.
getter/setter pair
promise → Future<T>?
The active fetch, if any.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state ↔ QueryState<T>
The current immutable state.
getter/setter pair

Methods

addObserver(QueryObserverHandle observer) → void
Attaches a reactive observer.
cancel({bool silent = false, bool revert = true}) → Future<void>
Cancels the active fetch and waits for it to stop.
destroy() → void
Stops timers, cancellation, and observer notifications.
fetch({ResolvedQueryOptions<T>? options, bool cancelRefetch = true, QueryFetchMeta? meta, Future<T>? initialFuture}) → Future<T>
Fetches data, deduplicating or replacing active work as configured.
invalidate() → void
Marks non-static data stale.
isStale([QueryFreshness? freshness, DateTime? now]) → bool
Returns whether data is missing, invalidated, or outside freshness.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFocus() → void
Handles application focus returning.
onReconnect() → void
Handles network connectivity returning.
removeObserver(QueryObserverHandle observer) → void
Detaches a reactive observer.
reset() → void
Restores initial state and cancels active work.
scheduleGc() → void
Schedules removal after the configured unused lifetime.
setData(T value, {DateTime? updatedAt, bool manual = true, ResolvedQueryOptions<T>? resolved}) → T
Stores successful value and returns the structurally shared result.
setOptions(QueryOptions<T> value) → void
Applies a new source definition to this cache entry.
setState(QueryState<T> value) → void
Replaces the complete query state.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited