Skip to main content

query_kit 1.0.3 copy "query_kit: ^1.0.3" to clipboard
query_kit: ^1.0.3 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.3 #

  • A fetch or a mutation met from another error zone than the one it began in now reaches that zone. Dart delivers a future's error only within the error zone the future was made in, so an await cancelQueries from another zone waited for good, clear, removeQueries and resetQueries reported the cancelled fetch's CancelledError as uncaught, a caller who joined a fetch or read Query.future never heard that it failed, and resumePausedMutations waited for good on a mutation that failed. A Flutter app has two error zones as soon as a runZonedGuarded wraps runApp, or a widget test's zone meets the binding's: a refetch on focus is started by a platform callback. Within one zone nothing changes.
  • QueryState, MutationState and DefaultedMutationOptions compare equal only to a value of the same type arguments. A QueryState<int> and an equal QueryState<num> used to be equal one way and not the other, so a Set held one or both depending on the order they went in. A comparison between the same type arguments is unchanged.
  • The errors reference gave a remedy that does not compile for the UnsupportedError an InfiniteQueryObserver throws for plain options. It now names both that do: the infinite options to setInfiniteOptions, or what client.infiniteObserverOptions makes of them to setOptions.

1.0.2 #

No change to the code. The documentation site moved to its own address, https://query-kit.dualmeta.io/; the package page's homepage and documentation links, the README and the library's dartdoc name it, and the former address redirects there. The README opens with a title a reader searches for, "TanStack Query for Dart | query_kit", instead of the package name, which pub.dev's own heading above it already shows.

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

  • QueryClient with a QueryCache: caching by QueryKey, staleTime and gcTime, request deduplication, retries with backoff (RetryPolicy, RetryDelay) and cancellation through QueryCancelToken.
  • QueryObserver for reactive reads, with sealed QueryResults (QueryPending, QuerySuccess, QueryError carrying the last good data).
  • Refetching on focus, on reconnect, on an interval (RefetchInterval) and after invalidateQueries; Enabled for dependent and lazy queries.
  • select, InitialData, PlaceholderData (including PlaceholderData.keepPrevious()) and structural sharing, extendable to your own classes with StructurallyShareable.
  • QueryClient.query for imperative reads — fetch, prefetch, "ensure" and stale-while-revalidate in one method.
  • getQueryData, setQueryData, updateQueryData, cancelQueries, refetchQueries, resetQueries, removeQueries, QueryFilters, and per-key defaults through setQueryDefaults.
  • consecutiveErrorCount on every result, so polling can give up after N failures.

Mutations

  • MutationObserver and MutationCache, with onMutate, onSuccess, onError and onSettled, optimistic updates and rollback.
  • MutationOptions.simple for mutations without an optimistic step; mutationFnWithContext and cancel() for cancellable mutations.
  • MutationScope to run writes one after another; paused mutations resume when the client is back online (resumePausedMutations).
  • MutationStateObserver for cache-wide mutation state, isMutating.

Infinite queries

  • InfiniteQueryObserver with fetchNextPage, fetchPreviousPage, hasNextPage and maxPages, over a typed InfinitePageContext.

Collections

  • QueriesObserver for a dynamic list of queries, and combine over 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.
  • QueryKey is a value type; a key is bound to one data type and a mismatched read throws QueryDataTypeError.
  • AppFocusManager, OnlineManager and NotifyManager owned per client; time goes through package:clock, so fake_async controls every timer.

Not in this release: persistence and hydration, streamedQuery, server-side rendering, devtools.

0
likes
160
points
491
downloads

Documentation

Documentation
API reference

Publisher

verified publisherdualmeta.io

Weekly Downloads

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.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#cache #state-management #data-fetching #tanstack-query #react-query

License

MIT (license)

Dependencies

clock, meta

More

Packages that depend on query_kit