flutter_svg
flutter_svg copied to clipboard
Support SVG in `<image>` tag.
this error is thrown attempting to render this svg. https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars
Code:
SvgPicture.network(
'https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars');
Exception
════════ Exception caught by SVG ═══════════════════════════════════════════════════════════════════
The following _Exception was thrown resolving a single-frame picture stream:
Exception: Could not instantiate image codec.
When the exception was thrown, this was the stack:
#0 _futurize (dart:ui/painting.dart:4338:5)
#1 instantiateImageCodec (dart:ui/painting.dart:1718:10)
#2 resolveImage.<anonymous closure> (package:flutter_svg/src/svg/parsers.dart:204:31)
#3 resolveImage (package:flutter_svg/src/svg/parsers.dart:218:23)
#4 _Elements.image (package:flutter_svg/src/svg/parser_state.dart:443:31)
...
Picture provider: NetworkPicture("https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars", headers: null, colorFilter: null)
Picture key: NetworkPicture("https://img.shields.io/github/stars/felangel/bloc.svg?style=flat&logo=github&colorB=deeppink&label=stars", headers: null, colorFilter: null)
This is using an <image> tag that actually has another SVG inside it.
I thought that it was weird that the content type was image/svg. So what should I understand? That's its an SVG or that it's an Image?
Oh, ok. So it's just something you need to support?
Right
Ok,got it. Thanks!
Having issues with this url as well. https://img.shields.io/discord/649708778631200778.svg?logo=discord&color=blue
I'm experiencing the exact symptoms in the title, albeit with a different problem. I converted svg containing png as data url with dart run vector_graphics_compiler -i, the original svg was over 1MB and it only came out to 80kB.
I'm experiencing the exact symptoms in the title, albeit with a different problem. I converted svg containing png as data url with
dart run vector_graphics_compiler -i, the original svg was over 1MB and it only came out to 80kB.
Is it rendering correctly?
SVGs generally encode image data as base64. VG just stores the binary version of the image and saves a bit of space that way. @jeiea if you can share the SVG I'd be interested in seeing it. It's possible it had lots of other "noise" that VG strips out, but that'd be a lot more than I'd expect.
No, just picture is not shown.. https://fastupload.io/CznUYrI1JYEeT7N/file
That site does not work for me. Can you attach it to this issue?
.
Vector Graphics oly supports PNG images right now. Adding JPEG wouldn't be hard.