DEV Community

Neto Ukpong
Neto Ukpong

Posted on

How to Render an SVG Image in Flutter

By default, Flutter does not support SVG images.
You would need an external package to render the images.

In comes flutter_svg to the rescue.

Here's a link to the pub.dev page.

Adding the plugin

To add the package, run:
flutter pub add flutter_svg
This adds the package to your pubspec.yaml file. Afterwards, you will need to install it, run:
flutter pub get

Using flutter_svg in your app

import:'package:flutter_svg/flutter_svg.dart'

@override
Widget build(BuildContext context) {
 return SafeArea(
    child: Center(
      child: SvgPicture.asset('assets/image.svg')
    ),
  );
Enter fullscreen mode Exit fullscreen mode

Top comments (0)