asset_cache
2.2.0, released a year ago by apptakk.com
Load and cache any asset type with a custom decoder
WASM-ready
What it does
asset_cache provides generic and typed caches for binary, image, json, and text assets. It stores decoded objects in memory and offers cache management and preloading.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need fast repeated access to local assets
- You want a simple in-memory cache without external dependencies
- You need custom decoding logic for assets
Skip it when
- You require persistent storage across app restarts
- You need disk caching or eviction policies
- You are already using a full-featured asset bundle manager
Strengths
- Zero external dependencies beyond flutter and path
- Built-in support for common asset types
- Easy preloading and cache management
- Custom exception handling
Weaknesses
- Only in-memory cache, no persistence
- No eviction strategy for large caches
- Limited to assets bundled with the app
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add dependency, declare assets in pubspec, create cache instance
final imageCache = ImageAssetCache(basePath: "assets/images/");
final image = await imageCache.load('sprite.png');Alternatives
Packages that do the same job and could replace asset_cache.
- sqlite_crdt
Dart implementation of Conflict-free Replicated Data Types (CRDTs) using Sqlite
49Compare - postgres_crdt
Dart CRDT client for PostgreSQL
44Compare