skip to Main Content

I am using Image Picker to select an image from the gallery. When I don’t have any images uploaded, after I add one image, this pop-up is appearing as shown below.
enter image description here

If I press "Select More Photos…", the image or images are not added after selection. How to get rid of this pop-up or what do I need to change in my code to be able to Select More Photos if he wants. I read that Image Picker is unable to handle picking multiple images once, and I don’t need that necessarily, so I need to get rid of this pop-up, because even if I select only one image from "Select more photos…", it is not added.

 void _openCameraAndAddPossibleImage(String? cleverClosetOrganizer, String cameraOrGallery, int isMyClosetCheck) async{
    try{
      var pickedFile = await ImagePicker().pickImage(
        source: cameraOrGallery == 'camera' ? ImageSource.camera : ImageSource.gallery,
      );
      if (pickedFile != null) {
        var imageFile = File(pickedFile.path);
        Uint8List imageRaw = await imageFile.readAsBytes();
        String newImage = CleverCloset.base64String(imageRaw);
        if (mounted) {
        setState(() {
          if(isMyClosetCheck==1) {
            CleverCloset cleverClosetToAdd = CleverCloset(closetOrganizer: cleverClosetOrganizer, isMyCloset: isMyClosetCheck, image: newImage);
            addImageOnClosetOrganizer(cleverClosetToAdd);
          }
          else {
            CleverCloset cleverClosetToAdd = CleverCloset(isMyCloset: isMyClosetCheck, image: newImage);
            addImageOnToBuy(cleverClosetToAdd);
          }
        });

        }
      }
    }
   catch (e){
      return ;
   }

  }

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    Based on this discussion https://github.com/flutter/flutter/issues/65995, I find out that it's a common bug on iOS.

    I solved this issue by adding:

     image_picker:
        git:
          url: https://github.com/cpboyd/plugins.git
          ref: ios-no-permissions
          path: packages/image_picker/image_picker
    

    Using this branch, it will remove the pop-up.


  2. Please try passing requestFullMetadata: false to pickImage function:

    ImagePicker().pickImage(source: ImageSource.camera, requestFullMetadata: false);
    

    As per docs:

    If requestFullMetadata is set to true, the plugin tries to get the
    full image metadata which may require extra permission requests on
    some platforms, such as Photo Library Usage permission on iOS.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search