cached_any_image 0.1.2 copy "cached_any_image: ^0.1.2" to clipboard
cached_any_image: ^0.1.2 copied to clipboard

A cache-aware Flutter widget that renders both raster images and SVGs from a single API.

example/lib/main.dart

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

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'cached_any_image demo',
      home: Scaffold(
        appBar: AppBar(title: const Text('CachedAnyImage Demo')),
        body: ListView(
          padding: const EdgeInsets.all(16),
          children: const [
            Text('SVG (via URL):'),
            SizedBox(height: 8),
            CachedAnyImage(
              url:
                  'https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg',
              width: 120,
              height: 120,
              fit: BoxFit.contain,
            ),
            SizedBox(height: 24),
            Text('Raster (via URL):'),
            SizedBox(height: 8),
            CachedAnyImage(
              url: 'https://picsum.photos/600/300',
              height: 160,
              fit: BoxFit.cover,
            ),
          ],
        ),
      ),
    );
  }
}