pickImage method

Future<AttachmentResult?> pickImage({
  1. bool enableCropping = true,
})

Picks a single image from the device gallery.

If enableCropping is true, launches the image cropper after selection.

Implementation

Future<AttachmentResult?> pickImage({bool enableCropping = true}) async {
  try {
    final String? path = await _channel.invokeMethod('pickImage');
    if (path == null) return null;

    final file = enableCropping ? await cropImage(path) : File(path);
    return file != null ? _resultFromPath(file.path) : null;
  } catch (e) {
    debugPrint('PixelToPdfService: pickImage error: $e');
    return null;
  }
}