flutter_media_cache 2.0.1 copy "flutter_media_cache: ^2.0.1" to clipboard
flutter_media_cache: ^2.0.1 copied to clipboard

A powerful Flutter package for caching images and videos with customizable expiration time and automatic cache management.

Changelog #

2.0.1 — 2026-06-25 #

✨ New Features #

  • Web platform support — package now works on all 6 Flutter platforms: Android · iOS · Web · macOS · Windows · Linux.
  • MediaCacheManager.formatBytes(int) utility for human-readable cache sizes.
  • MediaCacheManager.totalCacheSize getter (memory bytes on web, disk bytes on native).

🔧 Improvements #

  • CachedVideo on web uses VideoPlayerController.networkUrl() automatically — no code changes needed in calling code.
  • All disk I/O isolated behind PlatformStorage conditional-import abstraction; dart:io is never imported on web.
  • CacheIndex rewritten to be dart:io-free (serialises via Uint8List).
  • Orphaned file cleanup (purgeOrphans) runs at startup on native platforms.

🐛 Bug Fixes #

  • Fixed: Package failed to compile on Flutter Web due to dart:io imports in media_cache_manager.dart and cached_video.dart.
  • Fixed: CachedVideo crashed on web with "Video file path unavailable".
  • Fixed: pub point issues.

2.0.0 — 2026-06-25 #

⚠️ Breaking Changes #

  • Complete rewrite — public API is redesigned. See README for migration guide.
  • FlutterMediaCache class replaced by MediaCacheManager singleton.
  • CachedImage constructor parameters reorganised (imageUrl replaces url).

✨ New Features #

  • Priority download queueDownloadPriority.high/normal/low per request.
  • Request deduplication — duplicate URLs share one in-flight download.
  • Exponential-backoff retry — configurable via CacheConfig.maxRetries.
  • Per-download progress streamStream<DownloadProgress> with bytes received.
  • Conditional HTTP GETETag / Last-Modified / If-None-Match support.
  • Smart LRU eviction — separate memory (item count) and disk (byte size) limits.
  • Preloading APIMediaCacheManager.instance.preloadAll([...]).
  • CancellationcancelDownload(url) stops queued or in-flight tasks.
  • CachedVideo widget with built-in progress indicator and playback controls.
  • DownloadProgressBuilder for fully custom progress UIs.
  • CacheManagerProvider InheritedWidget for dependency injection.
  • CacheStats — hit count, miss count, eviction count, hit rate, total size.
  • Atomic index persistence — write-then-rename prevents index corruption.
  • Orphan file cleanup — dangling files not in the index are removed on startup.

🔧 Improvements #

  • Cache keys now use SHA-256 (not MD5) for collision-resistance.
  • Download engine lives on the main isolate with async/await — no Isolate overhead for small payloads, correct Flutter API access.
  • CacheConfig.copyWith() for easy per-screen overrides.
  • Debounced index writes (2 s) — avoids disk thrash on rapid requests.
  • ResizeImage support in CachedImage to reduce decoded memory footprint.

🐛 Bug Fixes #

  • Fixed: Concurrent requests for the same URL triggered multiple downloads.
  • Fixed: Memory cache could grow unboundedly.
  • Fixed: Download failures were silently swallowed.
  • Fixed: Stale index entries for missing files caused errors.

[1.x.x] — Legacy #

See Git history for 1.x changes.

1
likes
150
points
44
downloads

Documentation

API reference

Publisher

verified publisherswanflutterdev.com

Weekly Downloads

A powerful Flutter package for caching images and videos with customizable expiration time and automatic cache management.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

crypto, flutter, http, path_provider_master, video_player

More

Packages that depend on flutter_media_cache