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