Skip to main content

Overview

Cached query is a collection of dart and flutter libraries inspired by tools such as SWR, React Query and RTKQuery from the React world.

It helps reduce the pain and repetitiveness of caching and updating server data.

The Cached Query packages are:

Features​

A Brief Overview Of How It Works...​

All queries are stored in a global cache so that they are available anywhere in the project. When a query is instantiated it will check the global cache for the specified key and either return a pre-existing query or create a new one.

When the result of a query is requested it will always emit the currently stored value. If the data stored inside a query is stale it will be re-fetched in the background.

This package uses darts built in streams to track the number of listeners attached to each query. Once a query has no more listeners it will be removed from memory after a specific cache duration.