how to set quality based on image size from image picker library of flutter? I wanted to set limitation in mb before uploading using picker library

Viewed 102

Here is my code. Instead of passing jus 50 in image quality paramater. I wanted to set the image I am getting from this image picker library not to greater than 2 mb.

try {
  var image = await ImagePicker.platform
      .pickImage(source: imageSource, imageQuality: 50);
  if (image != null) {
    onImagePicked(image);
    Navigator.pop(context);
  }
} catch (e) {
  return null;
}
0 Answers
Related