QoraClientConfig class
Global configuration for QoraClient.
Applied to every query as the default baseline. Individual queries can override specific fields by passing QoraOptions to QoraClient.fetchQuery or QoraClient.watchQuery.
Example
final client = QoraClient(
config: QoraClientConfig(
defaultOptions: QoraOptions(
staleTime: Duration(minutes: 5),
gcTime: Duration(minutes: 10),
retryCount: 2,
),
debugMode: kDebugMode,
maxCacheSize: 200,
refetchOnMount: true,
errorMapper: (error, stackTrace) => QoraException(
error is DioException ? error.message ?? 'Network error' : '$error',
originalError: error,
stackTrace: stackTrace,
),
onCacheEvict: (key) => print('Evicted: $key'),
onBackgroundFetchError: (error, stackTrace, key) =>
crashReporter.report(error, stackTrace, key),
),
);
Constructors
- QoraClientConfig({QoraOptions defaultOptions = const QoraOptions(), QoraException errorMapper(Object error, StackTrace? stackTrace)?, bool debugMode = false, int? maxCacheSize, void onCacheEvict(List key)?, void onBackgroundFetchError(Object error, StackTrace? stackTrace, List queryKey)?, bool refetchOnMount = true, ReconnectStrategy reconnectStrategy = const ReconnectStrategy(), MutationQueueConfig mutationQueue = const MutationQueueConfig()})
-
const
Properties
- debugMode → bool
-
Enables verbose logging to the console.
final
- defaultOptions → QoraOptions
-
Default options applied to every query.
final
- errorMapper → QoraException Function(Object error, StackTrace? stackTrace)?
-
Transforms raw errors into QoraException before they are stored in
Failure states.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxCacheSize → int?
-
Maximum number of queries held in cache simultaneously.
final
- mutationQueue → MutationQueueConfig
-
Retry policy of the queue of registered mutations
(
QoraClient.mutationQueue). See MutationQueueConfig.final - onBackgroundFetchError → void Function(Object error, StackTrace? stackTrace, List queryKey)?
-
Callback invoked when a background fetch fails: a revalidation triggered
by QoraClient.watchQuery or QoraClient.fetchQuery, a
QoraClient.prefetch, or a fetch paused offline and replayed on
reconnect.
final
- onCacheEvict → void Function(List key)?
-
Callback invoked whenever a cache entry is evicted: either via LRU,
GC timer, QoraClient.removeQuery, or QoraClient.clear.
final
- reconnectStrategy → ReconnectStrategy
-
Controls how paused queries are replayed in batches when the device
reconnects.
final
- refetchOnMount → bool
-
Global default for whether QoraClient.watchQuery should trigger a fetch on the
first subscription, even when fresh cached data already exists.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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