ZenQueryConfig<T> class

Configuration for ZenQuery.

Supports true partial overrides when merged with ZenQueryClient defaults: only fields explicitly passed to the constructor override the base config, while all public getters remain non-nullable and fall back to library defaults.

Annotations

Constructors

ZenQueryConfig({Duration? staleTime, Duration? cacheTime, RefetchBehavior? refetchOnMount, RefetchBehavior? refetchOnFocus, RefetchBehavior? refetchOnReconnect, NetworkMode? networkMode, Duration? refetchInterval, bool? enableBackgroundRefetch, int? retryCount, Duration? retryDelay, RetryDelayFn? retryDelayFn, Duration? maxRetryDelay, double? retryBackoffMultiplier, bool? exponentialBackoff, bool? retryWithJitter, bool? retryWhenOnline, bool? autoPauseOnBackground, bool? refetchOnResume, bool? persist, T fromJson(Map<String, dynamic> json)?, Map<String, dynamic> toJson(T data)?, ZenStorage? storage, T? placeholderData})
const

Properties

autoPauseOnBackground → bool
Whether to automatically pause queries when app goes to background (default: false).
no setter
cacheTime → Duration
How long inactive cache data remains in memory before garbage collection (default: 5 minutes).
no setter
enableBackgroundRefetch → bool
Whether to enable background refetching (default: false).
no setter
exponentialBackoff → bool
Whether to use exponential backoff for retries (default: true).
no setter
fromJson → T Function(Map<String, dynamic> json)?
Function to deserialize a Map<String, dynamic> into data (for hydration).
final
hashCode → int
The hash code for this object.
no setterinherited
maxRetryDelay → Duration
Maximum delay for retries (default: 30 seconds).
no setter
networkMode → NetworkMode
Network usage mode (default: NetworkMode.online).
no setter
persist → bool
Whether to persist this query's data (default: false).
no setter
placeholderData → T?
Placeholder data to show while the query is loading. This does not persist to cache.
final
refetchInterval → Duration?
Interval for background refetching (null = disabled).
final
refetchOnFocus → RefetchBehavior
Whether to refetch when window gains focus (default: RefetchBehavior.never).
no setter
refetchOnMount → RefetchBehavior
Whether to refetch when component mounts (default: RefetchBehavior.ifStale).
no setter
refetchOnReconnect → RefetchBehavior
Whether to refetch when network reconnects (default: RefetchBehavior.ifStale).
no setter
refetchOnResume → bool
Whether to refetch stale data when resuming from background (default: false).
no setter
retryBackoffMultiplier → double
Multiplier for exponential backoff (default: 2.0).
no setter
retryCount → int
Number of retry attempts (default: 3).
no setter
retryDelay → Duration
Base delay between retries when retryDelayFn is null (default: 200ms).
no setter
retryDelayFn → RetryDelayFn?
Custom function to calculate retry delay based on attempt and error.
final
retryWhenOnline → bool
Whether to pause retrying when offline and resume automatically on reconnect (default: false).
no setter
retryWithJitter → bool
Whether to add random jitter to retry delays (default: true).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
staleTime → Duration
How long data remains fresh before being considered stale (default: 30 seconds).
no setter
storage → ZenStorage?
Custom storage implementation (defaults to global storage if null).
final
toJson → Map<String, dynamic> Function(T data)?
Function to serialize data into a Map<String, dynamic> (for persistence).
final

Methods

cast<R>() → ZenQueryConfig<R>
Cast configuration to a new type, preserving partial-override fields.
copyWith({Duration? staleTime, Duration? cacheTime, RefetchBehavior? refetchOnMount, RefetchBehavior? refetchOnFocus, RefetchBehavior? refetchOnReconnect, NetworkMode? networkMode, Duration? refetchInterval, bool? enableBackgroundRefetch, int? retryCount, Duration? retryDelay, RetryDelayFn? retryDelayFn, Duration? maxRetryDelay, double? retryBackoffMultiplier, bool? exponentialBackoff, bool? retryWithJitter, bool? retryWhenOnline, bool? autoPauseOnBackground, bool? refetchOnResume, bool? persist, T fromJson(Map<String, dynamic> json)?, Map<String, dynamic> toJson(T data)?, ZenStorage? storage, T? placeholderData}) → ZenQueryConfig<T>
Create a copy with specific fields overridden while keeping unset fields unset so subsequent merge calls still preserve partial semantics.
merge(ZenQueryConfig<T>? other) → ZenQueryConfig<T>
Merge with another config (explicit fields on other take precedence, while omitted fields on other preserve this config's values).
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