Home > Software design >  Flutter - how add svg image?
Flutter - how add svg image?

Time:09-22

enter image description here The following UnimplementedError was thrown in parseSvgElement: The element is not implemented in this library.

Style elements are not supported by this library and the requested SVG may not render as intended.

If possible, ensure the SVG uses inline styles and/or attributes (which are supported), or use a preprocessing utility such as svgcleaner to inline the styles for you. 2

Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#e5679(), name: "assets/image/foodigo.svg", colorFilter: null, theme: SvgTheme(currentColor: Color(0xff000000), fontSize: 14.0, xHeight: 7.0))

CodePudding user response:

Not all SVG features are supported by flutter_svg package, as stated here.

You can try to use an online tool to "clean up" your SVG file (search for "SVG clean/optimize") or you can use one of the tools suggested in the same link above (like usvg).

I would suggest usvg if you have a lot of files to process.

CodePudding user response:

You can also use flutter svg provider package for that : https://pub.dev/packages/flutter_svg_provider

  • Related