0

I am not good at English, so I used a translator and a dictionary. Please understand if there is an awkward sentence, and if you don't understand what I'm saying, please let me know.

For certain flutter projects, importing the crop_your_image package results in the following error:

: Error: The getter 'data' isn't defined for the class 'ExifData'.
- 'ExifData' is from 'package:image/src/exif/exif_data.dart' ('../../../AppData/Local/Pub/Cache/hosted/pub.dev/image-3.3.0/lib/src/exif/exif_data.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'data'.
  switch (tempImage?.exif.data[0x0112] ?? -1) {
                          ^^^^

Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

The error code is located in crop.dart:730.

// decode orientation awared Image.
image.Image _fromByteData(Uint8List data) {
  final tempImage = image.decodeImage(data);
  assert(tempImage != null);

  // check orientation
  switch (tempImage?.exif.data[0x0112] ?? -1) {  // This Line
    case 3:
      return image.copyRotate(tempImage!, 180);
    case 6:
      return image.copyRotate(tempImage!, 90);
    case 8:
      return image.copyRotate(tempImage!, -90);
  }
  return tempImage!;
}

When I deleted the crop_your_image package, the error disappeared, so it seems clear that there is a problem with the package.

Strangely, however, other projects using the crop_your_image package worked without problems.

There was a problem with the project I was working on.

https://github.com/AdHoc2675/showwing

There was no problem with the project to practice the crop_your_image package.

https://github.com/chooyan-eng/crop_your_image_gallery

https://github.com/AdHoc2675/flutter_crop_your_image_practice1

AdHoc
  • 1
  • 3

1 Answers1

0

My issue is resolved since I upgrade the version to 0.7.0. Hopefully it will work for you too.

Anuj Yadav
  • 11
  • 4
  • When suggesting that readers upgrade to a newer version, it's useful to also include the source version you're upgrading from in order to help constrain the range of this advice. – Jeremy Caney Apr 14 '23 at 00:22