11

I want to use SVG/Vector Graphics in my Flutter Application. is there any library or Dart Package which can be used?

Developine
  • 12,483
  • 8
  • 38
  • 42

2 Answers2

6

steps

  1. use this plugin flutter_svg https://pub.dartlang.org/packages/flutter_svg
  2. adding images to Assets
  3. import and adding this widget
SvgPicture.asset('assets/images/Defect/icon${values[index].childId}.svg', height: 50.0,),
E.Benedos
  • 1,585
  • 14
  • 41
2

To display the SVG from Assets in Flutter.

  1. Add the following code in pubspec.yaml file under dependencies flutter_svg: ^0.22.0
  2. Add the following code in the header of your main.dart import 'package:flutter_svg/flutter_svg.dart';
  3. Assign the SVG to one variable like final String assetName = 'assets/images/avatar.svg';
  4. new SvgPicture.Asset(assetName, height:100, width:100,)
Mahmood Sanjrani
  • 108
  • 3
  • 19
Balaji Ks
  • 342
  • 3
  • 9
  • 2
    Sadly flutter_svg is extremly limited. Most SVG taken out of the box will actually not work. – MappaM Mar 08 '21 at 09:26