ZenQueryClient class
Client for managing query configuration and cache.
Inspired by TanStack Query's QueryClient pattern, this provides a centralized place to configure default options for all queries.
Usage
// Create client with default options
final queryClient = ZenQueryClient(
defaultOptions: ZenQueryClientOptions(
queries: ZenQueryConfig(
staleTime: Duration.zero,
retryCount: 1,
),
),
);
// Register with Zen DI
Zen.put(queryClient);
// Queries automatically use these defaults
final query = ZenQuery(
queryKey: 'users',
fetcher: (token) => api.getUsers(),
);
- Annotations
Constructors
- ZenQueryClient({ZenQueryClientOptions defaultOptions = const ZenQueryClientOptions()})
-
const
Properties
- defaultOptions → ZenQueryClientOptions
-
Default options for all queries
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getQueryDefaults(
) → ZenQueryConfig - Get default options for queries
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveQueryConfig<
T> (ZenQueryConfig? instanceConfig) → ZenQueryConfig< T> - Resolve config for a specific query Merges: client defaults -> instance config
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited