Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Svg image not showing in flutter

Tags:

flutter

SvgPicture.asset('assets/images/close_icon.svg', color: Colors.white,)

not showing image. output error is

The following StateError was thrown resolving a single-frame picture stream:

Bad state: Could not parse "currentColor" as a color.

like image 933
Ash Khachatryan Avatar asked Apr 06 '20 13:04

Ash Khachatryan


People also ask

Why is my SVG not showing Flutter?

The Main Version of Flutter Does Not Support SVG There is an SVG directory in the code of Skia, which is a basic component of Flutter. However, Skia can only serialize images into SVG files. Therefore, you cannot decode or render SVG images with Skia.

Does SVG work in Flutter?

Although Flutter doesn't support SVG natively, the Dart-native flutter_svg package has excellent performant and fast support for SVG files.

What is SVG in flutter?

Scalable Vector Graphics (SVG) is one of the most widely used file image formats in applications. Because it offers several advantages over bitmap files, especially when it comes to retaining image quality while scaling, it’s difficult to start building a Flutter application without first considering using SVG.

How do I use flutter_SVG with Adobe Illustrator?

To use make the most use of flutter_svg with Adobe Illustrator, you need to follow specific recommendations: Images: choose to embed, not link, to another file to get a single SVG with no dependency on other files Objects IDs: choose layer names in order to add a name to every layer for SVG tags, or use minimal layer names — the choice is yours!

How to load an SVG from an SVG code?

Finally, you can load an SVG from an SVG code: Once you have your SVG file loaded, the first step is to change the color or tint of the image: Using a semantics label helps to describe the purpose of the image and enhances accessibility.

How do I use flutter_SVG with Dart?

Alternatively, you can add flutter_svg to your pubspec.yaml file: Make sure that you run flutter pub get either in your terminal or using your editor. Once installation is complete, import the package in your Dart code where you want to use this package:


1 Answers

You can open your svg asset assets/images/close_icon.svg and edit color property from currentColor to any other valid color (like black or white).

like image 164
francis_m Avatar answered Oct 07 '22 14:10

francis_m