Skip to content
pubscout

cached_storage

3.3.1, released 3 weeks ago by cachedquery.dev

Adds persistent storage to CachedQuery using Sqflite

WASM-ready
$ flutter pub add cached_storage
Source repository

What it does

It stores query results on disk as JSON and can deserialize them back to Dart objects. The storage is initialized once and then all CachedQuery queries are automatically persisted.

AI-written summary of version 3.3.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want queries to survive app restarts
  • You already use CachedQuery for caching
  • You need a simple SQL-backed storage without writing raw SQL

Skip it when

  • You are not using CachedQuery
  • You need a key‑value store or secure storage instead of SQL

Strengths

  • Built on Sqflite, no extra dependencies
  • Automatic persistence for all queries
  • Supports any JSON‑serializable data
  • Easy to initialize with CachedStorage.ensureInitialized()

Weaknesses

  • Only works with CachedQuery
  • Relies on Sqflite, so only works on mobile/desktop
  • No support for encrypted storage

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
3

await CachedStorage.ensureInitialized() before first query

void main() async {
  CachedQuery.instance.configFlutter(
    storage: await CachedStorage.ensureInitialized(),
  );
}

Alternatives

Packages that do the same job and could replace cached_storage.

Works with

Packages commonly used together with cached_storage: ones it builds on, ones built on it, and its own family.