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

Production-grade Flutter media caching library with LRU eviction, priority download queue, deduplication, retry logic, progress streams, and conditional HTTP GET (ETag / Last-Modified) support.

example/lib/main.dart

// example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_media_cache/flutter_media_cache.dart';

import 'screens/home_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // ── Initialize the cache manager once at startup ──────────────────────────
  await MediaCacheManager.initialize(
    config: const CacheConfig(
      maxDiskBytes: 300 * 1024 * 1024, // 300 MB on disk
      maxMemoryItems: 200, // 200 images in RAM
      maxAge: Duration(days: 30),
      maxConcurrentDownloads: 6,
      maxRetries: 3,
    ),
  );

  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Media Cache Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(colorSchemeSeed: Colors.deepPurple, useMaterial3: true),
      home: const HomeScreen(),
    );
  }
}
1
likes
0
points
44
downloads

Publisher

verified publisherswanflutterdev.com

Weekly Downloads

Production-grade Flutter media caching library with LRU eviction, priority download queue, deduplication, retry logic, progress streams, and conditional HTTP GET (ETag / Last-Modified) support.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

crypto, flutter, http, path_provider_master, video_player

More

Packages that depend on flutter_media_cache