flutter_svg_image 1.1.0 copy "flutter_svg_image: ^1.1.0" to clipboard
flutter_svg_image: ^1.1.0 copied to clipboard

Svg ImageProvider for Flutter. Use jovial_svg or WebView to parse svg and use flutter_cache_manager to cache svg files.

example/lib/main.dart

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

void main() async {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _webViewCreated = false;

  @override
  void initState() {
    super.initState();
    SvgWebImage.initWebView().then((value) {
      setState(() {
        _webViewCreated = true;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              Image(
                fit: BoxFit.contain,
                image: SvgImage.cachedNetwork(
                  'https://jovial.com/images/jupiter.svg',
                ),
              ),
              if (_webViewCreated)
                Image(
                  fit: BoxFit.contain,
                  image: SvgWebImage.cachedNetwork(
                    'https://jovial.com/images/jupiter.svg',
                    cacheSvg: true,
                  ),
                ),
            ],
          ),
        ),
      ),
    );
  }
}
8
likes
140
pub points
86%
popularity

Publisher

unverified uploader

Svg ImageProvider for Flutter. Use jovial_svg or WebView to parse svg and use flutter_cache_manager to cache svg files.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_cache_manager, flutter_image_compress, flutter_inappwebview, jovial_svg

More

Packages that depend on flutter_svg_image