pickImage static method

Future<XFile?> pickImage({
  1. required ImageSource source,
  2. double? maxWidth,
  3. double? maxHeight,
  4. int? imageQuality,
  5. CameraDevice preferredCameraDevice = CameraDevice.rear,
  6. bool requestFullMetadata = true,
})

Implementation

static Future<XFile?> pickImage({
  required ImageSource source,
  double? maxWidth,
  double? maxHeight,
  int? imageQuality,
  CameraDevice preferredCameraDevice = CameraDevice.rear,
  bool requestFullMetadata = true,
}) async {
  try {
    final ImagePicker picker = ImagePicker();
    final XFile? image = await picker.pickImage(
      source: source,
      maxWidth: maxWidth,
      maxHeight: maxHeight,
      imageQuality: imageQuality,
      preferredCameraDevice: preferredCameraDevice,
      requestFullMetadata: requestFullMetadata,
    );
    return image;
  } catch (e) {
    LoggerService.logError('Utils pickImage: could not pick image: $e');
  }
  return null;
}