Skip to main content

API reference

These pages list the public surface a user touches, one page per surface, in tables: every option, field and member with its type, its default and what it does, and the name it has in TanStack Query. Each row links to the generated dartdoc, which has the full signature and the longer explanation.

PageWhat it covers
QueryClientThe client: fetching, reading and writing the cache, operating on many queries at once, defaults, mounting and clearing.
OptionsQueryOptions, QueryObserverOptions, the infinite and mutation options — every field — and the sealed option values (StaleTime, GcTime, RetryPolicy, RefetchOn, …).
ResultsWhat a reader is handed: QueryResult and its three cases, QueryState, InfiniteData and the paging flags, MutationResult, MutationState, CombinedResult.
Widgets and controllersThe Flutter binding: QueryClientProvider, the four call styles, listeners, collections, OnlineStatus.
Caches and observersQueryCache and MutationCache with their events, Query and Mutation, the observers, the filters, and the focus, online and notify managers.
ErrorsEvery error either package throws or records, and every check a debug build runs.

A typical app touches them in that order: it builds a client with some defaults, describes its queries with options, reads results through a widget or a controller, and looks at the caches and errors when something needs explaining.

The generated dartdoc​

Every public member of both packages carries a dartdoc comment, and pub.dev builds and hosts the reference for every published version:

dart doc in a package's directory writes the same reference to doc/api/; open doc/api/index.html. For a package in your pub cache, run it there.

Where to start reading​

If you wantStart at
the whole imperative surfaceQueryClient
what a widget is handedQueryResult, and its QueryPending / QuerySuccess / QueryError cases
every option and what unset meansthe options, then the option values
pagingthe infinite fields, InfiniteData, InfiniteQueryObserver
writesthe mutation fields, MutationResult, MutationController
the cachesQueryCache, MutationCache, filters
the Flutter sideQueryClientProvider and the four call styles
widget testsnothing exported: the teardown is a documented snippet, see Testing

Beyond signatures​

In React Query

TanStack Query's React reference is generated, one page per function, class and interface: useQuery, QueryClient, QueryCache, QueryObserverOptions, QueryObserverSuccessResult and so on. Here the pages group by surface instead, and the options and the results have a page each, because the four call styles share them.