Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: Instance member 'cropImage' can't be accessed using static access

Tags:

flutter

dart

class ImagesCropper {
static Future<File?> cropImage(XFile file) async {
final File? croppedImage = await ImageCropper.cropImage(
  sourcePath: file.path,
  aspectRatioPresets:
      Platform.isAndroid ? crossAspectRatioAndroid : crossAspectRatioIos,
  androidUiSettings: androidUiSettings,
  iosUiSettings: iosUiSettings,
);
return croppedImage;
}
}

i put the full code here:

https://controlc.com/9590e7b1

and here's the error in debug console debug console

debug console

like image 290
Naito Avatar asked Mar 02 '26 06:03

Naito


1 Answers

Just change ImageCropper.cropImage to ImageCropper().cropImage. This will use a new instance of ImageCropper.

like image 167
Maikol Bonilla Gil Avatar answered Mar 04 '26 23:03

Maikol Bonilla Gil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!