Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.43k stars 651 forks source link

How to load svg image? #383

Open KingMatrix1989 opened 4 years ago

KingMatrix1989 commented 4 years ago

Hi. It seems package not working for SVG image. I get following error in case of svg image: **Exception: Could not instantiate image codec.**

renefloor commented 4 years ago

SVG's are not supported by basic flutter images. You will have to use flutter_svg for that. https://medium.com/flutter-community/using-svg-in-flutter-3dcf7b1dd713

I guess we could create something that add caching to flutter_svg, but it's better to build it directly into that library.

KingMatrix1989 commented 4 years ago

It's recommended seriously. I have not found any alternative. thank you.

mahendragp commented 3 years ago

is there any update on this?

I am also not able to load svg images using this library.

nastaran-mohammadi commented 2 years ago

is there any update on this?

kevin4dhd commented 2 years ago

any solution?

thanglq-teraark commented 2 years ago

Same issue. Workaround with https://pub.dev/packages/flutter_svg. We can check like this.

if (_isSvgPicture()) {
      return SvgPicture.network(
        imageUrl,
      );

    return CachedNetworkImage(
      imageUrl: imageUrl,
    );
}
tieorange commented 2 years ago

It would be great if you can pass a provider for SVG in this lib

And still using a caching mechanism from this lib

raunak-many-ac commented 2 years ago

Any Solution?

kazbeksultanov commented 2 years ago

Any Solution? It will be great to have svg built in the library.

jonneroni commented 1 year ago

Adding support for SVG's would be awesome.

guyluz11 commented 1 year ago

I think flutter_advanced_networkimage_2 has svg support, if someone can take inspiration from it and implement it here it will be wonderful.

TheRedSpy15 commented 1 year ago

Here's a temporary library https://github.com/Abdelazeem777/cached_network_svg_image

TheRedSpy15 commented 1 year ago

If you are only going to be using svg images, https://pub.dev/packages/flutter_svg is the way to go. All network svgs are cached by default regardless of http headers