I tried adding an image with a SVG source to my flutter application.
new AssetImage("assets/images/candle.svg"))
But I didn't get any visual feedback.
How can I render an SVG picture in Flutter?
dartflutter
I tried adding an image with a SVG source to my flutter application.
new AssetImage("assets/images/candle.svg"))
But I didn't get any visual feedback.
How can I render an SVG picture in Flutter?
Best Answer
Fonts are a great option for a lot of cases.
I've been working on a library to render SVGs on a canvas, available here: https://github.com/dnfield/flutter_svg
The API as of right now would look something like
to render asset_name.svg (sized to its parent, e.g. a
SizedBox
). You can also specify acolor
andblendMode
for tinting the asset..It's now available on pub and works with a minimum of Flutter version 0.3.6. It handles a bunch of cases but not everything - see the GitHub repo for updates and to file issues.
The original GitHub issue referenced by Colin Jackson is really not meant to be primarily focused on SVG in Flutter. I opened another issue here for that: https://github.com/flutter/flutter/issues/15501