resolve<T> method
Resolves every runtime option for value.
Implementation
ResolvedQueryOptions<T> resolve<T>(QueryOptions<T> value) {
_requireKeyType<T>(value.key);
final policy = getQueryDefaults(value.key).merge(value.policy);
final networkMode = policy.networkMode ?? QueryNetworkMode.online;
return ResolvedQueryOptions<T>(
key: value.key,
query: value.query,
freshness:
policy.freshness ?? const QueryFreshness.staleAfter(Duration.zero),
gcTime: policy.gcTime ?? const Duration(minutes: 5),
retry:
policy.retry ??
QueryRetry.times(options.environment.isServer ? 0 : 3),
retryDelay: policy.retryDelay ?? defaultQueryRetryDelay,
networkMode: networkMode,
refetchOnMount: policy.refetchOnMount ?? QueryRefetchPolicy.stale,
refetchOnFocus: policy.refetchOnFocus ?? QueryRefetchPolicy.stale,
refetchOnReconnect:
policy.refetchOnReconnect ??
(networkMode == QueryNetworkMode.always
? QueryRefetchPolicy.never
: QueryRefetchPolicy.stale),
refetchInterval: policy.refetchInterval,
refetchInBackground: policy.refetchInBackground ?? false,
enabled: policy.enabled ?? true,
structuralSharing: policy.structuralSharing ?? true,
initialData: value.initialData,
meta: Map<String, Object?>.unmodifiable(value.meta),
merge: value.merge,
);
}