DefaultQueryOptions class

Default options applied to all queries in a QueryClient.

These defaults are used when individual queries do not specify their own values. Query-specific options always take precedence over these defaults.

Example:

QueryClient(
  defaultQueryOptions: DefaultQueryOptions(
    staleDuration: StaleDuration(minutes: 5),
    gcDuration: GcDuration(minutes: 10),
    refetchOnMount: RefetchOnMount.always,
  ),
);

Constructors

DefaultQueryOptions({bool enabled = true, NetworkMode networkMode = NetworkMode.online, StaleDuration staleDuration = StaleDuration.zero, GcDuration gcDuration = const GcDuration(minutes: 5), Duration? refetchInterval, RefetchOnMount refetchOnMount = RefetchOnMount.stale, RefetchOnResume refetchOnResume = RefetchOnResume.stale, RefetchOnReconnect refetchOnReconnect = RefetchOnReconnect.stale, RetryResolver? retry, bool retryOnMount = true, Map<String, dynamic>? meta})
Creates default query options.
const

Properties

enabled → bool
Whether queries are enabled by default.
final
gcDuration → GcDuration
How long unused query data remains in memory before garbage collection.
final
hashCode → int
The hash code for this object.
no setteroverride
meta → Map<String, dynamic>?
Arbitrary metadata to attach to queries.
final
networkMode → NetworkMode
The network connectivity mode for queries.
final
refetchInterval → Duration?
Interval at which queries automatically refetch in the background.
final
refetchOnMount → RefetchOnMount
Whether to refetch when an observer mounts.
final
refetchOnReconnect → RefetchOnReconnect
Whether to refetch when network connectivity is restored.
final
refetchOnResume → RefetchOnResume
Whether to refetch when the app resumes from background.
final
retry → RetryResolver?
Retry behavior for failed queries.
final
retryOnMount → bool
Whether to retry a failed query when a new observer mounts.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
staleDuration → StaleDuration
How long query data is considered fresh before becoming stale.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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