Skip to content
pubscout

cross_cache

1.1.1, released 2 months ago by flyer.chat

Cross-platform caching library for Flutter using IndexedDB and the file system.

WASM-ready
$ flutter pub add cross_cache
Source repository

What it does

A simple cross-platform caching library for Flutter. It automatically manages storage using IndexedDB on the web and the file system on mobile and desktop platforms, and uses Dio for network requests.

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

Use it when

  • You need to cache network resources or images across mobile, desktop, and web.
  • You want a drop-in ImageProvider replacement that uses local cache.
  • You need direct key-value cache operations like get, set, delete, and contains.

Skip it when

  • You need complex relational queries or a robust local database like SQLite.
  • You require advanced cache purging strategies like LRU, MRU, or FIFO out of the box.

Strengths

  • Cross-platform support utilizing IndexedDB on web and file system on IO platforms.
  • Includes a built-in CachedNetworkImage provider for Flutter widgets.
  • Supports multiple resource sources including network URLs, assets, data URIs, and base64 strings.

Weaknesses

  • Lacks automatic cache purging or maximum size/item count configuration.
  • Does not currently support cancellation for downloads in progress.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
5
import 'package:cross_cache/cross_cache.dart';
import 'package:dio/dio.dart';

final cache = CrossCache();

Future<void> loadImageData(String imageUrl) async {
  final imageData = await cache.downloadAndSave(imageUrl);
}

// Remember to dispose when done
// cache.dispose();

Alternatives

Packages that do the same job and could replace cross_cache.

  • flutter_cache_manager

    Pick if you need a widely used, mature file caching manager with built-in automatic purging and advanced cache control.

Works with

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