Check Mobile App
Read now
Start a Project

SVG in Flutter


In this article, we are going to learn how to use SVG in Flutter. So let’s get started.

What is SVG and why to use ?

You may be heard of something like SVG icons because of their popularity among designers or developers.

SVG stands for Scalable Vector Graphics which is an XML-based markup language for describing 2D-based vector graphics. SVG images can be rendered at any size without losing quality.

Using SVG’s in Flutter

If you use SVGs like others i.e. png, jpg into your or Image.asset, you will get an image codec error.

Because they are not supported yet.

Fortunately, there is a solution from the Flutter community, the flutter_svg package.

We start by adding this package to pubspec.yaml:

After that, import it and use it like any other widget into your Flutter project:

I have used this SVG:

Issue with this package

If you use SVG that contains <style> element your SVG will be rendered into the flutter app as there are no <style> elements in your SVG or colorless because this package doesn’t support CSS style in SVG yet. You can use inline styles in your SVG which are supported by this package as detailed here.

Thanks for reading.

Happy Coding 🙂

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home