QoraClient class

Implemented types
Implementers

Constructors

QoraClient({QoraClientConfig? config, QoraTracker? tracker})
Creates a QoraClient.

Properties

activeMutations → Map<String, MutationUpdate>
Snapshot of all currently running (pending) mutations, keyed by controller ID.
no setter
cachedKeys → Iterable<List>
All currently cached query keys (normalised).
no setter
config → QoraClientConfig
Global configuration for this client instance.
final
fetchingCountStream → Stream<int>
Stream that emits the total number of in-flight query requests each time the count changes.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isFetchingCount → int
The number of query requests currently in flight.
no setter
isOnline → bool
true when a ConnectivityManager is attached and reports online status, or when no manager is configured (assumed online by default).
no setter
mutationEvents → Stream<MutationUpdate>
Real-time stream of all mutation state changes from tracked MutationControllers.
no setter
mutationQueue → MutationQueue
The queue of registered mutations.
no setter
mutationRegistry → MutationRegistry
The mutations registered on this client, by key.
no setter
networkStatus → NetworkStatus
The current network status as reported by the attached ConnectivityManager.
no setter
offlineMutationQueue → OfflineMutationQueue
The shared queue for mutations enqueued while offline.
no setter
pendingOfflineMutations → List
A snapshot of all mutations currently waiting in the offline queue.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

attachConnectivityManager(ConnectivityManager manager) → void
Attaches a ConnectivityManager and begins listening to network status changes.
attachLifecycleManager(LifecycleManager manager) → void
Attaches a LifecycleManager and wires refetchOnWindowFocus behaviour.
clear() → void
Remove all cached queries and cancel all pending requests.
clearCache() → void
Clear the in-memory cache only. Persisted storage is untouched. Use clear to wipe both (if using persistence), or clearStorage to wipe storage only.
clearHydrationQueue() → void
Remove all pending hydration entries.
debugInfo() → Map<String, dynamic>
Returns a debug snapshot of the current cache and mutation state.
debugSetQueryError(Object key, Object error) → void
Forces the cached entry for key into a Failure state with error.
dispose() → void
Release all resources held by this client.
fetchQuery<T>({required Object key, required Future<T> fetcher(), QoraOptions? options, CancelToken? cancelToken}) → Future<T>
Fetch data once and return the result.
getInfiniteQueryData<TData, TPageParam>(Object key) → InfiniteData<TData, TPageParam>?
Returns the loaded InfiniteData for key, or null when no pages have been fetched yet.
getInfiniteQueryState<TData, TPageParam>(Object key) → InfiniteQueryState<TData, TPageParam>
Returns the current InfiniteQueryState for key, or InfiniteInitial if no entry exists yet.
getQueryData<T>(Object key) → T?
Returns the cached data for key, or null if unavailable.
getQueryState<T>(Object key) → QoraState<T>
Returns the full QoraState for key, or Initial if not cached.
hasActiveWatcher(Object key) → bool
Returns true when key has at least one active watchQuery subscriber.
hydrateQuery<T>(Object key, T data, {DateTime? updatedAt}) → void
Pre-populate the cache with a previously persisted value.
invalidate(Object key) → void
Mark a query as stale and cancel any in-flight request for it.
invalidateInfiniteQuery(Object key) → void
Reset an infinite query to InfiniteInitial, signalling observers to re-fetch from the first page.
invalidatePrefix(Object prefix) → void
Invalidate every query whose key starts with prefix.
invalidateQueries({required QueryFilter filter}) → void
Invalidate all queries matching filter.
invalidateTags(List<QueryTag> tags) → Future<void>
Invalidate all queries that provide any of the given tags.
invalidateWhere(bool predicate(List key)) → void
Invalidate all queries whose normalised keys satisfy predicate.
markStale(Object key) → void
Marks the query for key as stale without notifying active observers.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFetchSuccess<T>(List key, T data) → void
Extension point for subclasses. Called synchronously after every successful fetch inside _doFetch: covering both direct fetches and SWR background revalidations.
prefetch<T>({required Object key, required Future<T> fetcher(), QoraOptions? options, CancelToken? cancelToken}) → Future<void>
Pre-warm the cache without creating a stream or blocking the caller's UI.
prepopulateCache<T>(Object key, QoraOptions options) → void
Eagerly seeds the cache with QoraOptions.initialData or QoraOptions.placeholderData before any fetch is triggered.
queueHydration(Object key, dynamic data, {DateTime? updatedAt}) → void
Enqueue a pre-deserialized value to be injected into the typed cache on the first typed API call (fetchQuery, watchQuery, etc.) for key.
registerMutation<TData, TVariables>(String key, {required RegisteredMutator<TData, TVariables> mutator, required QoraSerializer<TVariables> variables, List<Object>? invalidates, List<QueryTag>? invalidatesTags, String? scope(TVariables variables)?, bool isPermanent(Object error)?}) → void
Registers a mutation under key, so call sites can run it with MutationOptions(mutationKey: key) instead of passing a mutator.
removeHydrationEntry(Object key) → void
Remove the pending hydration entry for key without injecting it.
removeQuery(Object key) → void
Remove a single query from cache and cancel any pending requests for it.
restoreQueryData<T>(Object key, T? snapshot) → void
Restore query data from a previous snapshot (optimistic rollback).
setInfiniteQueryData<TData, TPageParam>(Object key, InfiniteData<TData, TPageParam> data, {bool? hasNextPage, bool? hasPreviousPage}) → void
Directly replace the loaded data for an infinite query.
setQueryData<T>(Object key, T data) → void
Manually set query data in the cache, instantly pushing the new Success state to all active watchQuery streams.
setTracker(QoraTracker tracker) → void
Replaces the active tracker with tracker.
toString() → String
A string representation of this object.
inherited
trackMutation<TData, TVariables>(String id, MutationState<TData, TVariables> state, {Map<String, Object?>? metadata}) → void
Called on every state transition of a MutationController.
override
untrackMutation(String id) → void
Called when a MutationController is disposed.
override
updateInfiniteQueryState<TData, TPageParam>(Object key, InfiniteQueryState<TData, TPageParam> state) → void
Push a new InfiniteQueryState for key to all active subscribers.
watchFetchStatus(Object key) → Stream<FetchStatus>
Returns a stream of FetchStatus changes for key.
watchInfiniteState<TData, TPageParam>(Object key) → Stream<InfiniteQueryState<TData, TPageParam>>
Observe the InfiniteQueryState for an infinite query by key.
watchQuery<T>({required Object key, required Future<T> fetcher(), QoraOptions? options, CancelToken? cancelToken}) → Stream<QoraState<T>>
Create a reactive Stream of QoraState for a query.
watchState<T>(Object key) → Stream<QoraState<T>>
Subscribe to the QoraState stream of a query without triggering a fetch.

Operators

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