flutter_tanstack_query library

Classes

AppLifecycleManager
Manages application lifecycle events for query refetching
InfiniteQuery<T, PageParam>
Manages the state and lifecycle of an infinite (paginated) data query.
InfiniteQueryOptions<T, PageParam>
Infinite query options
InfiniteQueryResult<T, PageParam>
Result object for useInfiniteQuery hook
InfiniteQueryState<T>
Mutation<T, V>
Manages the state and lifecycle of a data mutation (e.g., POST, PUT, DELETE).
MutationConfig<T, V>
Configuration options for a single mutation.
MutationOptions<T, V>
Mutation options
MutationResult<T, V>
Result object for useMutation hook
MutationState<T>
Represents the state of a mutation
NetworkPolicy
Monitors and provides the current network connectivity status.
Query<T>
Manages the state and lifecycle of a single data query.
QueryCache
Manages in-memory and persistent caching for queries.
QueryClient
The central client for managing all queries and mutations.
QueryClientProvider
An InheritedWidget that provides a QueryClient to its descendants.
QueryConfig
Configuration options for a single query.
QueryListener<T>
An internal widget used by useQuery and useMutation (or similar hooks) to listen to streams and trigger widget rebuilds.
QueryOptions<T>
Comprehensive query options that extend QueryConfig
QueryPage<T>
QueryPageAdapter<T>
Hive type adapter for QueryPage to enable persistent caching
QueryResult<T>
Result object for useQuery hook
QueryState<T>
Represents the state of a single query.
RetryConfig
Retry configuration for failed requests
UseInfiniteQuery<T, PageParam>
Hook-style widget for using infinite queries
UseMutation<T, V>
Hook-style widget for using mutations
UseQuery<T>
Hook-style widget for using queries
Value<T>
A wrapper class used in copyWith to distinguish between a null value being explicitly provided and a parameter being omitted.

Enums

MutationStatus
Defines the various statuses a mutation can be in
NetworkMode
Network mode options
NetworkStatus
Represents the current network connectivity status.
QueryStatus
Defines the various statues a query can be in

Functions

registerQueryAdapters() → void
Registers all necessary type adapters for the query cache
useInfiniteQuery<T, PageParam>(List<Object> queryKey, Future<T> fetcher({PageParam? pageParam}), {PageParam? getNextPageParam(T lastPage, List<T> allPages)?, PageParam? getPreviousPageParam(T lastPage, List<T> allPages)?, InfiniteQueryOptions<T, PageParam>? options, required Widget builder(BuildContext context, InfiniteQueryResult<T, PageParam> result)}) UseInfiniteQuery<T, PageParam>
Convenience function to create UseInfiniteQuery widget
useMutation<T, V>(MutationFetcher<T, V> mutationFn, {MutationOptions<T, V>? options, required Widget builder(BuildContext context, MutationResult<T, V> result)}) UseMutation<T, V>
Convenience function to create UseMutation widget
useQuery<T>(List<Object> queryKey, QueryFetcher<T> fetcher, {QueryOptions<T>? options, required Widget builder(BuildContext context, QueryResult<T> result)}) UseQuery<T>
Convenience function to create UseQuery widget

Typedefs

GetNextPageParam<T, PageParam> = PageParam? Function(T lastPage, List<T> allPages)
Function signature for determining the next page parameter
GetPreviousPageParam<T, PageParam> = PageParam? Function(T firstPage, List<T> allPages)
Function signature for determining the previous page parameter
InfiniteQueryFetcher<T, PageParam> = Future<T> Function({PageParam? pageParam})
Function signature for infinite query fetchers
MutationFetcher<T, V> = Future<T> Function(V variables)
Function signature for mutation fetchers T is the return type of the mutation V is the type of variables passed to the mutation
QueryFetcher<T> = Future<T> Function()
Function signature for query fetchers

Exceptions / Errors

MutationError
Custom error class for mutation-related errors
QueryError
Custom error class for query-related errors