Query<T> constructor

Query<T>({
  1. required List<Object> queryKey,
  2. required QueryFetcher<T> fetcher,
  3. required QueryCache cache,
  4. required NetworkPolicy networkPolicy,
  5. QueryConfig config = const QueryConfig(),
  6. void onSuccess()?,
  7. void onError(
    1. String error
    )?,
  8. void onRefreshError(
    1. String error
    )?,
})

Creates a Query instance.

Implementation

Query({
  required this.queryKey,
  required this.fetcher,
  required QueryCache cache,
  required NetworkPolicy networkPolicy,
  this.config = const QueryConfig(),
  void Function()? onSuccess,
  void Function(String error)? onError,
  void Function(String error)? onRefreshError,
}) : _cache = cache,
     _networkPolicy = networkPolicy,
     _onSuccess = onSuccess,
     _onError = onError,
     _onRefreshError = onRefreshError,
     _state = QueryState.idle() {
  // Debug: Log listener configuration
  debugPrint('🔧 Query created with listeners:');
  debugPrint('  - onSuccess: ${onSuccess != null ? "✅ SET" : "❌ NULL"}');
  debugPrint('  - onError: ${onError != null ? "✅ SET" : "❌ NULL"}');
  debugPrint(
    '  - onRefreshError: ${onRefreshError != null ? "✅ SET" : "❌ NULL"}',
  );
  _initialize();
}