androidiosimageflutterimage-load

Flutter NetworkImage failed to load HEIC image from url


In my NetworkImage my url is this https://joylist.s3.us-east-2.amazonaws.com/profile/5f229e9cfa3dc8542f815cb9.HEIC

And it throws this exception enter image description here

It worked fine with .jpg or png and other formats. Now, How can I resolve this and show this image.


Solution

  • You can work with the heic to jpg library (https://pub.dev/packages/heic_to_jpg) to achieve this (Except that you're specifically looking to show HEIC images).

    Add the package:

    dependencies:
      heic_to_jpg: ^0.1.2
    

    Import the package in your dart file:

    import 'package:heic_to_jpg/heic_to_jpg.dart';
    

    And call convert method with local HEIC/HEIF image file path.

    String jpegPath = await HeicToJpg.convert(heicPath);