lilian_cached_network_image 1.0.1 copy "lilian_cached_network_image: ^1.0.1" to clipboard
lilian_cached_network_image: ^1.0.1 copied to clipboard

A Flutter package for caching network images.

lilian_cached_network_image #

A Flutter package for loading and caching network images using a hybrid strategy: instant load for small images via SQLite blobs, and file system storage for larger images.

This package combines the strengths of flutter_cache_manager with a high-performance SQLite-based blob caching system.

Features #

  • Hybrid cache: Images ≤ 50KB are stored in SQLite as blobs for nearly instantaneous loading.
  • File system storage: Larger images are stored in the file system using flutter_cache_manager.
  • Built-in Shimmer loading: Includes a shimmer effect during image loading.
  • Fade transitions: Smooth fade-in transitions once the image is ready.
  • Highly Customizable: Custom placeholder builders, error builders, and cache managers.

Installation #

Add this to your pubspec.yaml:

dependencies:
  lilian_cached_network_image: ^1.0.0

Usage #

Widget #

import 'package:lilian_cached_network_image/lilian_cached_network_image.dart';

LilianCachedNetworkImage(
  imageUrl: 'https://example.com/image.jpg',
  width: 200,
  height: 200,
  borderRadius: BorderRadius.circular(12),
  useShimmer: true,  // default
)

ImageProvider #

CircleAvatar(
  backgroundImage: LilianCacheImageProvider(
    'https://example.com/avatar.jpg',
  ),
)

Configuration #

You can configure global cache settings:

LilianCacheManager.setup(
  stalePeriod: Duration(days: 7),      // default
  maxNrOfCacheObjects: 200,            // default
  blobThreshold: 50 * 1024,            // 50KB - threshold for SQLite blobs
);

Platform Support #

  • Mobile/Desktop: Supports both SQLite blob storage and file system caching.
  • Web: Uses file system caching (SQLite is not available in standard browser environments).

License #

MIT