cached_query_flutter library

Classes

CachedQuery
CachedQuery is a singleton that keeps track of all the cached queries
DevtoolsObserver
An observer to sent change events to the dev tools.
InfiniteQuery<T, Arg>
InfiniteQuery caches a series of Query's for use in an infinite list.
InfiniteQueryBuilder<T, A>
Listen to changed in an InfiniteQuery and build the ui with the result.
InfiniteQueryState<T>
InfiniteQueryState holds the current state of an InfiniteQuery
Mutation<ReturnType, Arg>
Mutation is used to create, update and delete data from an asynchronous source.
MutationBuilder<T, A>
Listen to changes in an Mutation and build the ui with the result.
MutationConsumer<T, A>
Listen to changes in an Mutation and call the listener with the result.
MutationListener<T, A>
Listen to changes in an Mutation and call the listener with the result.
MutationState<ReturnType>
MutationState holds the current state of an InfiniteQuery.
Query<T>
Query is will fetch and cache the response of the queryFn.
QueryBase<T, State extends QueryState<T>>
An Interface for both Query and InfiniteQuery.
QueryBuilder<T>
Listen to changes in an Mutation and build the ui with the result.
QueryConfig
QueryConfig is used to configure a Query.
QueryConfigFlutter
Query config including flutter options
QueryConsumer<T>
Listen to changes in an Query and call the listener with the result.
QueryListener<T>
Listen to changes in an Query and call the listener with the result.
QueryLoggingObserver
An observer to log changes in queries and mutations.
QueryObserver
Query Observer
QueryState<T>
QueryState holds the current state of a Query
StateBase<T>
An Interface for both QueryState and InfiniteQueryState.
StorageInterface
An interface for any storage adapter.
StoredQuery
The data stored in the database

Enums

QueryStatus
Generic status of a query or mutation.
RefetchReason
The reason the cache is being refetched.

Extensions

CachedQueryExt on CachedQuery
Flutter specific extension on CachedQuery
QueryStatusExt on QueryStatus
Extension methods for QueryStatus

Typedefs

GetNextArg<T, Arg> = Arg? Function(InfiniteQueryState<T> state)
Determines the parameters of the next page in an infinite query.
InfiniteQueryBuilderCondition<T> = FutureOr<bool> Function(InfiniteQueryState<T> oldState, InfiniteQueryState<T> newState)
This function is being called everytime the query registered in the InfiniteQueryBuilder receives new updates and let's you control when the _InfiniteQueryBuilderState.build method should be called
InfiniteQueryBuilderFunc<T, A> = Widget Function(BuildContext context, InfiniteQueryState<T> state, InfiniteQuery<T, A> query)
The builder function is called on each widget build.
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.
MutationBuilderCallback<T, A> = Widget Function(BuildContext context, MutationState<T> state, Future<MutationState<T?>> mutate(A args))
Listen to changes in an Mutation and build the ui with the result.
MutationBuilderCondition<T> = FutureOr<bool> Function(MutationState<T> oldState, MutationState<T> newState)
This function is being called everytime the query registered in the MutationBuilder receives new updates and let's you control when the _MutationBuilderState.build method should be called
MutationListenerCallback<T> = void Function(MutationState<T> state)
Called on each state change.
MutationListenerCondition<T> = FutureOr<bool> Function(MutationState<T> oldState, MutationState<T> newState)
This function is being called every time the mutation registered in the MutationListener receives new updates and let's you control when the MutationListenerCallback should be called
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.
QueryBuilderCallback<T> = Widget Function(BuildContext context, QueryState<T> state)
Called on each widget build.
QueryBuilderCondition<T> = FutureOr<bool> Function(QueryState<T> oldState, QueryState<T> newState)
This function is being called everytime the query registered in the QueryBuilder receives new updates and let's you control when the _QueryBuilderState.build method should be called
QueryFunc<T> = Future<T> Function()
The result of the QueryFunc will be cached.
QueryListenerCallback<T> = void Function(QueryState<T> state)
Called on each state change.
QueryListenerCondition<T> = FutureOr<bool> Function(QueryState<T> oldState, QueryState<T> newState)
This function is being called every time the query registered in the QueryListener receives new updates and let's you control when the QueryListenerCallback should be called
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.