0

Flutter Image picker is taking a while to capture image from camera on android

When I try to pick image using image_picker package , camera open file , but when I click capture button it takes about 2 or 3 seconds to capture image , any solutions ? code:

void pickImageFromCam() async {
try {
await ImagePicker()
          .pickImage(
source: kIsWeb ? ImageSource.gallery : ImageSource.camera,
requestFullMetadata: true,
imageQuality: 90,
maxHeight: 500,
maxWidth: 500)
          .then((value) {
if (value != null) {
if (imagesExtensions.contains(getExtension(value.name))) {
pickedFiles.add(CustomPickedFile(
file: File(value.path),
path: value.path,
fileExtension: getExtension(value.name),
fileName: value.name));

Helper.showSnackBar(context,
message: AppLocal.of(context).image_was_taken);
else {
_showDialog(
title: AppLocal.of(context).take_photo,
content: AppLocal.of(context)
                    .extension_should_be(imagesExtensions.join(' , ')));
          }
else {
_showDialog(
title: AppLocal.of(context).take_photo,
content: AppLocal.of(context).no_image_was_taken);
        }
      });
on IOException catch (error) {
log(error.toString());
    }
  }

enter image description here

Ahmed Ashraf
  • 125
  • 1
  • 8

0 Answers0