cached_storage
3.3.1, released 3 weeks ago by cachedquery.dev
Adds persistent storage to CachedQuery using Sqflite
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.
- simple_secure_storage
Secure key‑value storage for Flutter with platform‑specific backends.
77Compare - idb_sqflite
IndexedDB API implementation on top of sqflite for Flutter and Dart VM
81Compare - flutter_cache_manager
Generic cache manager for saving web files and cache info on device storage.
91Compare - sembast_sqflite
Sembast NoSQL database support built on top of sqflite for cross-process safety.
80Compare
Works with
Packages commonly used together with cached_storage: ones it builds on, ones built on it, and its own family.
- sqflitecached_storage depends on itSQLite plugin for Flutter supporting iOS, Android and MacOS.
- cached_querycached_storage depends on itLibrary for caching, background fetching, and managing server state in Dart and Flutter.
- cached_query_flutterSame familyWidgets and addons for Cached Query in Flutter including query and mutation builders.