QueryOptions<T> class

Comprehensive query options that extend QueryConfig

Constructors

QueryOptions({required List<Object> queryKey, QueryFetcher<T>? queryFn, Duration staleTime = const Duration(minutes: 5), Duration cacheTime = const Duration(minutes: 30), RetryConfig retryConfig = const RetryConfig(), bool refetchOnWindowFocus = true, bool refetchOnReconnect = true, bool refetchOnMount = true, bool enabled = true, T? initialData, T? placeholderData, bool keepPreviousData = false, bool structuralSharing = true, void onSuccess(T data)?, void onError(Object error)?, void onSettled(T? data, Object? error)?, R select<R>(T data)?, NetworkMode networkMode = NetworkMode.online, Map<String, dynamic>? meta})
const

Properties

cacheTime Duration
The duration for which data remains in cache
final
enabled bool
Whether the query is enabled
final
hashCode int
The hash code for this object.
no setterinherited
initialData → T?
Initial data to use while loading
final
keepPreviousData bool
Whether to keep previous data while fetching new data
final
meta Map<String, dynamic>?
Query metadata
final
networkMode NetworkMode
Network mode for the query
final
onError → void Function(Object error)?
Callback for query error
final
onSettled → void Function(T? data, Object? error)?
Callback for settled query (success or error)
final
onSuccess → void Function(T data)?
Callback for successful query
final
placeholderData → T?
Placeholder data to show while loading
final
queryFn QueryFetcher<T>?
Query fetcher function
final
queryKey List<Object>
Query key
final
refetchOnMount bool
Whether to refetch when component mounts
final
refetchOnReconnect bool
Whether to refetch when network reconnects
final
refetchOnWindowFocus bool
Whether to refetch when window regains focus
final
retryConfig RetryConfig
Retry configuration
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
select → R Function<R>(T data)?
Data selector to transform the data
final
staleTime Duration
The duration after which cached data is considered stale
final
structuralSharing bool
Whether to structure error as QueryError
final

Methods

copyWith({List<Object>? queryKey, QueryFetcher<T>? queryFn, Duration? staleTime, Duration? cacheTime, RetryConfig? retryConfig, bool? refetchOnWindowFocus, bool? refetchOnReconnect, bool? refetchOnMount, bool? enabled, T? initialData, T? placeholderData, bool? keepPreviousData, bool? structuralSharing, void onSuccess(T data)?, void onError(Object error)?, void onSettled(T? data, Object? error)?, R select<R>(T data)?, NetworkMode? networkMode, Map<String, dynamic>? meta}) QueryOptions<T>
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