pickAsBytes method

Future<Uint8List?> pickAsBytes({
  1. required BuildContext context,
  2. ImageSource imageSource = ImageSource.gallery,
  3. double? ratioX,
  4. double? ratioY,
})

Implementation

Future<Uint8List?> pickAsBytes(
    {required BuildContext context,
    ImageSource imageSource = ImageSource.gallery,
    double? ratioX,
    double? ratioY}) async {
  XFile? xFile =
      await getImagePicker(context)!.pickImage(source: imageSource);

  if (xFile == null) {
    return null;
  }

  return await _handleImageCropping(context, xFile,
      ratioX: ratioX, ratioY: ratioY, asBytes: true);
}