cached_query
library
Enums
QueryStatus
Generic status of a query or mutation.
Typedefs
GetNextArg <T , Arg >
= Arg? Function(InfiniteQueryState <T > 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 <T >
= 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
= dynamic Function(dynamic json )
Used to serialize or deserialize the query from storage.
ShouldRefetch
= bool Function(QueryBase query , bool afterStorage )
ShouldRefetch 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 re-fetched. The second
parameter (storageOnly) is true if the query has only been fetched from storage.
UpdateFunc <T >
= T? Function(T? oldData )
Update function used to update the data in a query.
WhereCallback
= bool Function(QueryBase query )
Should return true if a condition is met.