cached_query
library
Classes
Cacheable <State >
The interface for any cachable query.
CachedQuery
CachedQuery is a singleton that keeps track of all the cached queries
DevtoolsObserver
An observer to sent change events to the dev tools.
EmptyFetchFunction <T >
FetchFunction <T >
FetchOptions
Base class for QueryController and InfiniteQueryController.
GlobalQueryConfig
The global config for all queries.
InfiniteQuery <T , Arg >
InfiniteQuery caches a series of Query 's for use in an infinite list.
InfiniteQueryData <T , Arg >
An Interface for infinite query data.
InfiniteQueryError <T , Arg >
Error response of an infinite query.
InfiniteQueryInitial <T , Arg >
The initial state of the query, before the queryFn has been called.
InfiniteQueryLoading <T , Arg >
Loading state of an infinite query.
InfiniteQueryStatus <T , Arg >
InfiniteQueryStatus holds the current state of an InfiniteQuery
InfiniteQuerySuccess <T , Arg >
Successful response of an infinite query.
Mutation <ReturnType , Arg >
Mutation is used to create, update and delete data from an asynchronous
source.
MutationCache
Mutation cache is temporary in-memory storage for mutations while
they happen
MutationError <T >
The error state of the mutation.
MutationInitial <T >
The initial state of the mutation.
MutationLoading <T >
The loading state of the mutation.
MutationState <T >
MutationState holds the current state of a Mutation .
MutationSuccess <T >
The success state of the mutation.
Query <T >
Query is will fetch and cache the response of the queryFn.
QueryConfig <Data >
QueryConfig is used to configure a Query .
QueryController <T >
The QueryController is the base class and logic for both Query and InfiniteQuery .
QueryError <T >
The state of the query when an error is thrown.
QueryInitial <T >
The initial state of the query, before the queryFn has been called.
QueryLoading <T >
The state of the query when the queryFn is currently being called.
QueryLoggingObserver
An observer to log changes in queries and mutations.
QueryObserver
Query Observer
QueryState <T >
An Interface for the query state.
QueryStatus <T >
An Interface for the query state.
QuerySuccess <T >
The state of the query when the queryFn has been successfully called.
RetryConfig
Configuration for retrying failed query fetches.
StorageInterface
An interface for any storage adapter.
StoredQuery
The data stored in the database
Typedefs
Deserializer <T >
= T Function(dynamic json )
Used to deserialize the query from storage.
GetNextArg <T , Arg >
= Arg? Function(InfiniteQueryData <T , Arg > ? state )
Determines the parameters of the next page in an infinite query.
InfiniteQueryFunc <T , A >
= Future <T > Function(A pageArgs )
The result of the InfiniteQueryFunc will be cached.
KeyFilterFunc
= bool Function(Object unencodedKey , String key )
Used to match multiple queries.
MutationQueryCallback <ReturnType , Arg >
= Future <ReturnType > Function(Arg arg )
The asynchronous query function.
OnErrorCallback <Arg >
= FutureOr <void > Function(Arg arg , Object error , Object ? fallback )
Called when the queryFn as completed with an error.
OnQueryErrorCallback
= void Function(dynamic error )
On success is called when the query function is executed successfully.
OnQuerySuccessCallback <T >
= void Function(T data )
On success is called when the query function is executed successfully.
OnStartMutateCallback <Arg >
= FutureOr Function(Arg arg )
Called when Mutation has started.
OnSuccessCallback <T , Arg >
= FutureOr <void > Function(T res , Arg arg )
Called when the queryFn as completed with no error.
QueryFunc <T >
= Future <T > Function()
The result of the QueryFunc will be cached.
Serializer <T >
= dynamic Function(T data )
Used to serialize the query from storage.
ShouldFetch <Data >
= bool Function(Object key , Data? data , DateTime createdAt )
ShouldFetch is called before a query is fetched, both after the data is fetched from storage
and when a query is stale. This would usually not be necessary to use but can give
a high level of control over when a query should be fetched.
UpdateFunc <T >
= T Function(T? oldData )
Update function used to update the data in a query.
WhereCallback
= bool Function(Cacheable query )
Should return true if a condition is met.