fquery
library
Classes
DefaultQueryOptions
Default options for all queries.
InfiniteQueryBuilder <TData , TError extends Exception , TPageParam >
A Builder widget which uses useInfiniteQuery internally
InfiniteQueryData <TPage , TPageParam >
MutationBuilder <TData , TError , TVariables , TContext >
QueryBuilder <TData , TError extends Exception >
A Builder widget which uses useQuery internally
QueryClient
It is used to interact with the query cache.
Can also be used to configure queries on a global basis
using DefaultQueryOptions .
QueryClientBuilder <TData , TError >
QueryClientProvider
This can be used to provide a QueryClient throughout the application.
UseInfiniteQueryOptions <TData , TError , TPageParam >
UseInfiniteQueryResult <TData , TError , TPageParam >
UseMutationOptions <TData , TError , TVariables , TContext >
Options for configuring a mutation.
UseMutationResult <TData , TError , TVariables >
The result of a mutation, including the mutate function and status flags.
UseQueriesOptions <TData , TError >
UseQueryOptions <TData , TError >
Options for configuring a query.
UseQueryResult <TData , TError >
The result of a query, including the data, error, status flags, and a refetch function.
Functions
useInfiniteQuery <TData , TError extends Exception , TPageParam > (RawQueryKey queryKey , InfiniteQueryFn<TData , TPageParam > queryFn , {required TPageParam initialPageParam , required TPageParam? getNextPageParam (TData , List <TData > , TPageParam , List <TPageParam > ), TPageParam? getPreviousPageParam (TData , List <TData > , TPageParam , List <TPageParam > )?, int ? maxPages , bool enabled = true , RefetchOnMount ? refetchOnMount , Duration ? staleDuration , Duration ? cacheDuration , Duration ? refetchInterval , int ? retryCount , Duration ? retryDelay })
→ UseInfiniteQueryResult <TData , TError , TPageParam >
Used for infinite query. In addition to queryKey and queryFn,
it requires an initialPageParam and getNextPageParam option.
The query function receives the pageParam parameter
that can be used to fetch the current page.
useIsFetching ()
→ int
Hook to get the number of active fetches across all queries.
useMutation <TData , TError , TVariables , TContext > (Future <TData > mutationFn (TVariables ), {FutureOr <TContext > ? onMutate (TVariables )?, void onSuccess (TData , TVariables , TContext? )?, void onError (TError , TVariables , TContext? )?, void onSettled (TData? , TError? , TVariables , TContext? )? })
→ UseMutationResult <TData , TError , TVariables >
Builds a mutation and subscribes to it.
Takes a mutation function which either resolves or throws an error.
Returns a UseMutationResult
Example:
useQueries <TData , TError extends Exception > (List <UseQueriesOptions <TData , TError > > options )
→ List <UseQueryResult <TData , TError > >
useQuery <TData , TError extends Exception > (RawQueryKey queryKey , QueryFn<TData > fetcher , {bool enabled = true , RefetchOnMount ? refetchOnMount , Duration ? staleDuration , Duration ? cacheDuration , Duration ? refetchInterval , int ? retryCount , Duration ? retryDelay })
→ UseQueryResult <TData , TError >
Builds and subscribes to a query stored in the cache.
Takes a query key and a fetcher function which either resolves or throws an error.
Returns a UseQueryResult
useQueryClient ()
→ QueryClient
Obtains the provided instance of QueryClient
from the nearest QueryClientProvider ancestor.