hooks/index library

Functions

useDAQCache() DAQCache
Get the cache object that is provided through context
useInfiniteQuery<TData, TParams, TError>({required Future<DAQInfiniteQueryResponse<TData>> fetcher(TParams params, int page, int pageSize), required TError errorTransformer(Object, StackTrace), required String cachePrefix, required TParams initialParameters, int pageSize = 20, bool enableCache = true, bool autoFetch = true, List<String>? cacheTags, void onLoading(TParams parameters, DAQCache cacheInstance)?, void onSuccess(DAQInfiniteQueryResponse<TData>, DAQCache cacheInstance)?, void onError(TError error, DAQCache cacheInstance)?, Duration? timeToLive, bool? enablePeriodicTTLRefetch}) InfiniteQueryController<TData, TParams, TError>
Use infinite query hook
useInvalidationSub({required DAQCache cache, List<String>? cacheKeys, String? keyPattern, List<String>? cacheTags, required VoidCallback onInvalidated, String? logPrefix}) → void
Add invalidation subscription to the query hook
useMutation<TData, TVariables, TError>({required Future<TData> mutationFn(TVariables variables), void onSuccess(TData data, TVariables variables, DAQCache cacheInstance)?, void onError(TError error, TVariables variables, DAQCache cacheInstance)?, void onSettled()?, void onMutating(TVariables variables)?, required TError errorTransformer(Object error, StackTrace stackTrace), Duration? timeout, List<String>? invalidatePatterns, List<String>? invalidateTags, List<String>? invalidateKeys}) MutationController<TData, TVariables, TError>
Use mutation hook
useMutationSub<TData>({required DAQCache cache, List<String>? cacheKeys, String? keyPattern, List<String>? cacheTags, required void onMutated(TData mutatedData), String? logPrefix}) → void
Add mutation subscription to the query hook
useQuery<TData, TParams, TError>({required Future<TData> queryFn(TParams variables), required TError errorTransformer(Object, StackTrace), required String cachePrefix, required TParams parameters, void onLoading(TParams parameters)?, void onSuccess(TData data)?, void onError(TError error)?, void onSettled()?, bool enableCache = true, bool autoFetch = true, List<String>? cacheTags, Duration? timeToLive, bool? enablePeriodicTTLRefetch}) QueryController<TData, TParams, TError>
Use query hook
useTTLSub({required DAQCache cache, required List<String> cacheKeys, required Duration timeToLive, required VoidCallback onExpired, Duration checkInterval = const Duration(minutes: 1), String? logPrefix}) → void
Add TTL (Time To Live) subscription to periodically check cache entries and trigger refetch when they expire