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

> A lightweight image cache manager and widget for Flutter. Simple API, disk cache, configurable concurrent downloads.

example/main.dart

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

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

  final cacheManager = QSImageCacheManager(name: 'demo', maxCount: 200, retainDays: 7);
  await cacheManager.initial();

  runApp(MyApp(cacheManager: cacheManager));
}

class MyApp extends StatelessWidget {
  final QSImageCacheManager cacheManager;
  const MyApp({super.key, required this.cacheManager});

  @override
  Widget build(BuildContext context) {
    const testUrl = 'https://picsum.photos/300';

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('QSCachedImage Example')),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            QSCachedImage(
              url: testUrl,
              cacheManager: cacheManager,
              placeholder: const CircularProgressIndicator(),
              errorWidget: const Icon(Icons.error),
              downloadDone: () => debugPrint('Download complete!'),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () async {
                await cacheManager.removeCache(testUrl);
                debugPrint('Cache cleared for $testUrl');
              },
              child: const Text('Clear Cache'),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
150
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

> A lightweight image cache manager and widget for Flutter. Simple API, disk cache, configurable concurrent downloads.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

crypto, flutter, http, path_provider, synchronized

More

Packages that depend on qs_cached_image