pro_svg_image 0.0.1
pro_svg_image: ^0.0.1 copied to clipboard
A powerful and flexible SVG Image Provider for Flutter. Supports both high-performance rendering via jovial_svg and a WebView fallback for full SVG compatibility. Includes caching with flutter_cache_manager.
pro_svg_image #
A powerful and flexible **SVG Image Provider** for Flutter. Supports both high-performance rendering via jovial_svg
and a **WebView fallback** for full SVG compatibility. Includes caching with flutter_cache_manager
.
✅ Compatible with latest Flutter (>=3.7)
✅ Color-safe and scalable SVG support
✅ WebView fallback for complex SVGs
✅ Disk and memory caching out of the box
📦 Installation #
Add to your pubspec.yaml
:
dependencies:
pro_svg_image: ^0.0.1
🔧 Usage #
import 'package:pro_svg_image/pro_svg_image.dart';
1. Load SVG as ImageProvider (with caching) #
Image(
image: SvgImage.cachedNetwork('https://example.com/logo.svg'),
fit: BoxFit.contain,
);
2. Use as a Widget via ScalableImageWidget
#
ScalableImageWidget.fromSISource(
si: CachedNetworkSvgSource('https://example.com/logo.svg'),
fit: BoxFit.contain,
);
3. Fallback with WebView Rendering #
Useful for complex or unsupported SVG files (e.g. filters, animations, gradients)
SvgWebImage.initWebView(); // Call once (e.g. in main())
Image(
image: SvgWebImage.cachedNetwork(
'https://example.com/logo.svg',
cacheSvg: true,
),
fit: BoxFit.contain,
);
🛠️ Advanced #
Clear the cache manually if needed:
await SvgImage.clearCache(); // Clear all jovial_svg cache
await SvgWebImage.clearWebViewCache(); // Clear WebView cache
You can also pass your own BaseCacheManager
instance for custom cache behavior.
📌 Platform Support #
| Platform | Supported | Notes |
|----------|-----------|-----------------------------|
| Android | ✅ | Fully tested |
| iOS | ✅ | Fully tested |
| Web | ❌ | Not supported |
| Desktop | 🚧 | Partial WebView support |
🧱 Dependencies #
👨💻 Maintainer #
Maintained by Shajedul Islam