InfiniteQueryObserverOptionsBase<TPageData, TPageParam, TData> class
sealed
InfiniteQueryOptions plus the observer-only options: select,
placeholderData, the refetchOn* triggers, polling and
retryOnMount.
Sealed over exactly two shapes, as QueryObserverOptionsBase is:
InfiniteQueryObserverOptions, which has no select and whose data is
the InfiniteData the query holds, and InfiniteQuerySelectOptions,
which requires a select over it. They are separate classes because
Dart cannot infer the observed type from an optional select: with
select required on one class and absent from the other, the type of
what the observer reports (TData) is always anchored.
InfiniteQueryObserver and the Flutter binding's infinite entry points
take this base: either shape carries all three type arguments, so
inference reads them off the options and a call site names none.
There is no pages parameter here (see InfiniteQueryOptions.pages):
every refetch an observer triggers refetches all pages the query holds.
- Inheritance
-
- Object
- QueryOptions<
InfiniteData< TPageData, TPageParam> > - InfiniteQueryOptions<
TPageData, TPageParam> - InfiniteQueryObserverOptionsBase
- Annotations
Properties
- enabled → Enabled?
-
Whether the query may fetch on its own. The default: Enabled.yes. A
disabled query still serves whatever the cache holds and can still be
refetched by hand.
finalinherited
- gcTime → GcTime?
-
How long the query stays cached after its last observer leaves. The
default: GcTime.defaultValue, five minutes.
finalinherited
-
getNextPageParam
→ PageParamFn<
TPageData, TPageParam> -
Given the last page, the param for the one after it, or
nullwhen there is none. Required.finalinherited -
getPreviousPageParam
→ PageParamFn<
TPageData, TPageParam> ? -
Given the first page, the param for the one before it, or
nullwhen there is none. Default: none — unset,hasPreviousPageis always false and a previous-page fetch fetches nothing.finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
initialData
→ InitialData<
InfiniteData< ?TPageData, TPageParam> > -
Data the cache starts with, as if it had been fetched — see
InitialData. No default: unset, the query starts without data. Unlike
placeholderDatait is written to the cache, and it goes stale by staleTime from initialDataUpdatedAt on.finalinherited - initialDataUpdatedAt → DateTime?
-
When initialData was fetched, for the staleness clock. No default:
unset, the seed counts as fetched the moment it is written.
finalinherited
- initialDataUpdatedAtCompute → DateTime? Function()?
-
Computes the seed timestamp only when data is actually seeded. No
default. Mutually exclusive with initialDataUpdatedAt; a
nullresult means now.finalinherited - initialPageParam → TPageParam
-
The param the first page is fetched with. Required; there is no
default.
finalinherited
- maxPages → int?
-
How many pages to keep at most. Default: unset, which keeps every page;
0also keeps every page.finalinherited - meta → Object?
-
Arbitrary data carried along for logging, devtools or a query function,
which receives it as QueryFunctionContext.meta. No default: unset,
the key's registered default applies, if any.
finalinherited
- networkMode → NetworkMode?
-
How connectivity gates the fetch. The default: NetworkMode.online,
an offline device pauses the fetch until it is back.
finalinherited
-
pageFn
→ InfinitePageFn<
TPageData, TPageParam> -
Fetches one page, given its param and direction. Required.
finalinherited
- pages → int?
-
How many pages to fetch up front — used to warm a cache with several
pages, or to refetch a fixed number of them. Default: unset, which
fetches one page into an empty query and refetches as many pages as
the query already holds.
finalinherited
-
placeholderData
→ PlaceholderData<
InfiniteData< ?TPageData, TPageParam> > -
Pages shown while the query has none of its own, as an InfiniteData;
never written to the cache. Default: none. See
QueryObserverOptionsBase.placeholderData.
final
-
queryFn
→ QueryFn<
InfiniteData< ?TPageData, TPageParam> > -
Fetches the data. Unset, the query uses the function registered for its
key with QueryClient.setQueryDefaults; with none there either, a
fetch fails with MissingQueryFunctionError.
finalinherited
- queryKey → QueryKey
-
The key this query is cached under. Required. Bound to exactly one data
type: a key read as another type — a supertype included — throws
QueryDataTypeError.finalinherited - refetchInterval → RefetchInterval?
-
Polls the query on a timer while this observer is subscribed. Default
RefetchInterval.off. Each poll re-requests every held page, first to
last — mind the cost with many pages. See
QueryObserverOptionsBase.refetchInterval.
final
- refetchIntervalInBackground → bool?
-
Whether refetchInterval keeps polling while the app is not focused.
Default
false. See QueryObserverOptionsBase.refetchIntervalInBackground.final - refetchOnMount → RefetchOn?
-
Whether this observer subscribing triggers a refetch. Default
RefetchOn.ifStale. A refetch re-requests every held page, first to
last. See QueryObserverOptionsBase.refetchOnMount.
final
- refetchOnReconnect → RefetchOn?
-
Whether the device coming back online triggers a refetch. Default
RefetchOn.ifStale (RefetchOn.never under NetworkMode.always). A
refetch re-requests every held page, first to last. See
QueryObserverOptionsBase.refetchOnReconnect.
final
- refetchOnWindowFocus → RefetchOn?
-
Whether the app regaining focus triggers a refetch. Default
RefetchOn.ifStale. A refetch re-requests every held page, first to
last. See QueryObserverOptionsBase.refetchOnWindowFocus.
final
- retry → RetryPolicy?
-
Whether a failed fetch is retried. The default:
RetryPolicy.times(3), three retries after the first failure (TanStack Query:retry: 3). QueryClient.query is the exception: when neither these options nor the client's defaults set retry, its fetch is not retried.finalinherited - retryDelay → RetryDelay?
-
How long to wait between attempts. The default:
RetryDelay.defaultValue, exponential back-off from one second —
one, two, four, … — capped at thirty.
finalinherited
- retryOnMount → bool?
-
Whether a query that ended in an error is fetched again when an
observer subscribes. Default
true. See QueryObserverOptionsBase.retryOnMount.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
select
→ SelectFn<
InfiniteData< ?TPageData, TPageParam> , TData> -
QuerySelectOptions.select, over the whole InfiniteData — the place
to flatten pages into one list.
nullon an InfiniteQueryObserverOptions, never on an InfiniteQuerySelectOptions.no setter - staleTime → StaleTime?
-
How long fetched data counts as fresh. The default: StaleTime.zero,
stale the moment it arrives, so every mount, focus and reconnect
refetches.
finalinherited
-
structuralSharing
→ StructuralSharing<
InfiniteData< ?TPageData, TPageParam> > -
How new data is reconciled with what the cache already holds — see
StructuralSharing. The default:
replaceEqualDeep, which keeps every deep-equal part of the previous data. noStructuralSharing turns it off.finalinherited -
toStringFields
→ Map<
String, Object?> -
QueryOptions.toStringFields minus the derived
behaviorandqueryFn, plus the paging fields.no setteroverride
Methods
-
copyWith(
{QueryKey? queryKey, QueryFn< InfiniteData< ? queryFn, Enabled? enabled, StaleTime? staleTime, GcTime? gcTime, RetryPolicy? retry, RetryDelay? retryDelay, NetworkMode? networkMode, InitialData<TPageData, TPageParam> >InfiniteData< ? initialData, DateTime? initialDataUpdatedAt, DateTime? initialDataUpdatedAtCompute()?, StructuralSharing<TPageData, TPageParam> >InfiniteData< ? structuralSharing, Object? meta, InfinitePageFn<TPageData, TPageParam> >TPageData, TPageParam> ? pageFn, TPageParam? initialPageParam, PageParamFn<TPageData, TPageParam> ? getNextPageParam, PageParamFn<TPageData, TPageParam> ? getPreviousPageParam, int? maxPages, int? pages, PlaceholderData<InfiniteData< ? placeholderData, RefetchOn? refetchOnMount, RefetchOn? refetchOnWindowFocus, RefetchOn? refetchOnReconnect, RefetchInterval? refetchInterval, bool? refetchIntervalInBackground, bool? retryOnMount}) → InfiniteQueryObserverOptionsBase<TPageData, TPageParam> >TPageData, TPageParam, TData> -
This, with the given fields replaced, observer half included; each
shape returns its own type, and only InfiniteQuerySelectOptions.copyWith
accepts a
select.pagesis not accepted either: see InfiniteQueryOptions.pages.override -
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