Reputation: 2786
I got avif image from server but image not showing.
I have tried Image.network() and CachedNetworkImage to show avif image .
Exception: Invalid image data
When the exception was thrown, this was the stack:
#0 _futurize (dart:ui/painting.dart:5326:5)
#1 ImageDescriptor.encoded (dart:ui/painting.dart:5194:12)
#2 instantiateImageCodec (dart:ui/painting.dart:2048:60)
<asynchronous suspension>
Image provider: NetworkImage("https://www.soppiya.com/media/images/610fc7bb172b28ecf8655216/item/6122493b75ca8186640a03ae/image1.avif?x=62433", scale: 1.0)
Image key: NetworkImage("https://www.soppiya.com/media/images/610fc7bb172b28ecf8655216/item/6122493b75ca8186640a03ae/image1.avif?x=62433", scale: 1.0)
Upvotes: 1
Views: 3232
Reputation: 2989
That's right, AVIF is currently not supported by Flutter itself. There's an open issue for it here: https://github.com/flutter/flutter/issues/61229 . If AVIF support is important to you, then you can add a thumbs-up to the issue to help prioritize it.
As comments on that issue explain, Flutter uses the platform's decoder if one exists. So in particular for Android 12+, AVIF will work.
As another answer mentions (and is also in the issue thread), there is a third-party package that provides AVIF support for Flutter: https://pub.dev/packages/flutter_avif . So that's an option to consider if you need AVIF support.
Upvotes: 0
Reputation: 11
Here is a Flutter library that is capable of decoding and encoding AVIF photos.
https://github.com/yekeskin/flutter_avif
Upvotes: 0
Reputation: 63549
You can convert the image, while this is format is not supported.
The following image formats are supported: JPEG, PNG, GIF, Animated GIF, WebP, Animated WebP, BMP, and WBMP.
For more, read Image-class
Upvotes: 0