Skip to content

Error with .HEIF Image Format in iOS Simulator #184

@3pensozcn

Description

@3pensozcn

When i try to select an in image in .heif format from the gallery in ios simulator and show it in the crop package, i get the following error.

package:crop_your_image/src/logic/parser/image_image_parser.dart': Failed assertion: line 20 pos 10: 'tempImage != null': is not true.

code sample:

void onTapImage(AssetEntity imageData) async {
File? file = await imageData.file;
if (file != null) {
int sizeInBytes = (await imageData.originBytes)!.length;
double sizeInMB = sizeInBytes / (1024 * 1024);

    if (imageData.type == AssetType.image &&
        sizeInMB <= AppConstants.maxImageSizeMB) {
      selectedImages = await imageData.originBytes;
      nextPage();
    } else {
      context?.showImageErrorSnackbar(
        context!.t!.maxImageSizeMessage,
      );
      return;
    }
  }

notifyListeners();

}

when i try to use selectedImages inside the crop widget i got error above. to select the image i am using photo_manager package. when i use the imageData.thumnailData it show without problem.

flutter doctor results:

[✓] Flutter (Channel stable, 3.27.1, on macOS 15.1.1 24B91 darwin-arm64, locale en-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.95.3)
[✓] Connected device (4 available)
[✓] Network resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed fixIssues that @chooyan-eng need to do something

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions