Query<T> constructor
Query<T> ({
- required List<
Object> queryKey, - required QueryFetcher<
T> fetcher, - required QueryCache cache,
- required NetworkPolicy networkPolicy,
- QueryConfig config = const QueryConfig(),
- void onSuccess()?,
- void onError(
- String error
- void onRefreshError(
- 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();
}