flutter_image_cache 1.0.2 copy "flutter_image_cache: ^1.0.2" to clipboard
flutter_image_cache: ^1.0.2 copied to clipboard

A Flutter package for image caching with automatic cache management.

flutter_image_cache #

A Flutter package for efficient image caching with automatic cache management.
It downloads images from the web, stores them in a local cache, and automatically cleans old or unused images to stay within the specified cache size.

Features #

  • Automatic caching of images downloaded from URLs.
  • Cache size management with automatic cleanup.
  • Cache usage tracking.
  • Customizable placeholder, error handling, and frame builders.
  • Thread-safe downloads and cache access using mutexes.

Limitations #

  • The package currently supports only one cache instance at a time.
    Concurrent use of multiple CacheManager objects is not supported and may lead to unexpected behavior.
    It is therefore recommended to use a single, global instance of CacheManager throughout the entire application.

Getting Started #

Installation #

Add the flutter_image_cache package to your pubspec dependencies.

Usage #

Create a static CacheManager and pass it to the CachedImage widget constructor.
The API is similar to Image.file().

import "package:flutter_image_cache/flutter_image_cache.dart";

final CacheSize cacheSize = CacheSize(miB: 10); // Create a cache of maximum size 10 MiB
final static CacheManager cacheManager = CacheManager(maxCacheSize: cacheSize);

// Create the widget
CachedImage(
  "https://example.com/image.jpg",
  cacheManager: cacheManager,
)
0
likes
150
points
182
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for image caching with automatic cache management.

Repository (GitHub)
View/report issues

Topics

#cache #image #image-cache #network-image

Documentation

API reference

License

MIT (license)

Dependencies

crypto, dio, flutter, mutex, path, path_provider, sqflite

More

Packages that depend on flutter_image_cache