Multi Image Provider

🌟 A versatile Flutter widget for displaying images with a consistent API. It supports asset images, cached network images, and SVG images while providing customizable styling such as aspect ratio, border radius, placeholders, and error widgets.

✨ Features

  • ✅ Display asset images
  • ✅ Display cached network images
  • ✅ Display SVG assets
  • ✅ Display cached SVG network images
  • ✅ Automatic image caching for network images
  • ✅ Custom aspect ratio support
  • ✅ Border radius customization
  • ✅ Decoration support
  • ✅ Placeholder widget support
  • ✅ Error widget support

🚀 Installation

Add the package to your pubspec.yaml:

dependencies:
  multi_image_provider: ^1.0.3

Then run:

flutter pub get

🛠 Import

import 'package:multi_image_provider/multi_image_provider.dart';

⚙️ Initialization

Initialize the cache manager before running your application.

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  ImageCacheManager.init(
    stalePeriod: const Duration(days: 100),
    maxNrOfCacheObjects: 500,
  );

  runApp(const MyApp());
}

📦 Asset Image

MultiImage(
  imagePath: "assets/image.jpg",
  borderRadius: BorderRadius.all(
    Radius.circular(30),
  ),
)

🌐 Cached Network Image

MultiImage(
  imageType: ImageType.network,
  imagePath:
      "https://images.pexels.com/photos/378570/pexels-photo-378570.jpeg",
  borderRadius: BorderRadius.all(
    Radius.circular(20),
  ),
  aspectRatio: 1,
)

🧩 SVG Asset

MultiImage(
  imageType: ImageType.svgAsset,
  imagePath: "assets/sample.svg",
  width: 200,
  height: 200,
)

🕸 Cached SVG Network Image

MultiImage(
  imageType: ImageType.svgNetwork,
  imagePath:
      "https://www.svgrepo.com/show/530486/earphone.svg",
  width: 300,
  height: 300,
)

📌 Supported Platforms

Platform Supported
Android
iOS
Windows
Linux
macOS
Web
WASM

⚠️ Notes

This package currently does not support Web or WASM because it depends on:

  • flutter_cache_manager
  • path_provider

These dependencies are not currently compatible with Web/WASM caching.

Libraries

multi_image_provider
Multi Image Provider Library