pickImage static method

Future<File?> pickImage(
  1. ImageSource imageSource
)

Implementation

static Future<File?> pickImage(ImageSource imageSource) async {
  final ImagePicker picker = ImagePicker();
  final XFile? image = await picker.pickImage(
    source: imageSource,
    maxWidth: 400,
    maxHeight: 400,
  );

  if (image != null) {
    return File(image.path);
  }

  return null;
}