svg_image

Pub Version Likes Popularity Pub Points

svg_image is a Flutter package that allows you to easily view SVG files or other images using a single widget.

Introduction

The svg_image package simplifies the process of displaying SVG files or images in your Flutter app. With a unified widget, you can load images from different sources with minimal configuration.

Features

  • Load and display SVG files.
  • Supports network and asset image paths.
  • Simple and easy-to-use API.

Installation

Add the following to your pubspec.yaml file:

dependencies:
  svg_image: ^0.0.1
  • Add this code to main
void main() async{
WidgetsFlutterBinding.ensureInitialized();
await SvgImageConfig.init();
runApp(const MyApp());
}

Example

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('SVG Image Example'),
        ),
        body: Center(
          child: SvgImage(
            path: 'YOUR_PATH',
            type: PathType.network, // Change to PathType.asset for asset images
          ),
        ),
      ),
    );
  }
}

Libraries

svg_image