query_kit 1.0.1
query_kit: ^1.0.1 copied to clipboard
TanStack Query for Dart: a port of query-core with caching, background refetching, retries and mutations, no Flutter needed. AI-coded, not affiliated with TanStack.
Changelog #
1.0.1 #
No change to the code. The package page now names the documentation site, https://dualmeta-gmbh.github.io/query_kit/, as its homepage and documentation, the README opens with a link to it, the quick start, the examples and the API reference, and the description says what the package is: TanStack Query for Dart.
1.0.0 #
First release. query_kit is a Dart port of TanStack Query's query-core:
a cache for server state with no Flutter dependency. The Flutter binding is
query_kit_flutter. From here
on, a breaking change is a major version.
query_kit is an entirely AI-coded project: all code, tests and documentation were written by AI coding agents (Anthropic's Claude). A human maintainer set the goals and reviews releases, but did not write the code. It is a community port, not affiliated with or endorsed by TanStack.
Queries
QueryClientwith aQueryCache: caching byQueryKey,staleTimeandgcTime, request deduplication, retries with backoff (RetryPolicy,RetryDelay) and cancellation throughQueryCancelToken.QueryObserverfor reactive reads, with sealedQueryResults (QueryPending,QuerySuccess,QueryErrorcarrying the last good data).- Refetching on focus, on reconnect, on an interval (
RefetchInterval) and afterinvalidateQueries;Enabledfor dependent and lazy queries. select,InitialData,PlaceholderData(includingPlaceholderData.keepPrevious()) and structural sharing, extendable to your own classes withStructurallyShareable.QueryClient.queryfor imperative reads — fetch, prefetch, "ensure" and stale-while-revalidate in one method.getQueryData,setQueryData,updateQueryData,cancelQueries,refetchQueries,resetQueries,removeQueries,QueryFilters, and per-key defaults throughsetQueryDefaults.consecutiveErrorCounton every result, so polling can give up after N failures.
Mutations
MutationObserverandMutationCache, withonMutate,onSuccess,onErrorandonSettled, optimistic updates and rollback.MutationOptions.simplefor mutations without an optimistic step;mutationFnWithContextandcancel()for cancellable mutations.MutationScopeto run writes one after another; paused mutations resume when the client is back online (resumePausedMutations).MutationStateObserverfor cache-wide mutation state,isMutating.
Infinite queries
InfiniteQueryObserverwithfetchNextPage,fetchPreviousPage,hasNextPageandmaxPages, over a typedInfinitePageContext.
Collections
QueriesObserverfor a dynamic list of queries, andcombineover a record or a list of results (CombinedResult,CombineMemo,optional(),combineWith).
Dart-first design
- Sealed option values (
StaleTime,GcTime,Enabled,RetryPolicy,RefetchOn,RefetchInterval, …) instead of magic numbers. QueryKeyis a value type; a key is bound to one data type and a mismatched read throwsQueryDataTypeError.AppFocusManager,OnlineManagerandNotifyManagerowned per client; time goes throughpackage:clock, sofake_asynccontrols every timer.
Not in this release: persistence and hydration, streamedQuery,
server-side rendering, devtools.