2

I am using the below code to get pick image in flutter application, when the code is run on Android it works fine, but when the same code is run on iOS it crashes the app while tapping the button to pick the image. How should I resolve it?

ERROR I GET

Lost connection to device.

final ImagePicker _picker = ImagePicker();
  Future getImage() async {
    print("get image");

    PickedFile image = await _picker.getImage(source: ImageSource.gallery);

    if (image != null) {
      setState(() {
        final File file = File(image.path);
        avatarImageFile = file;
        isLoading = true;

      });
    }
  }

info.plist propertiesenter image description here

1 Answers1

0

You have to add the below permission in Info.plist file in XCode.

Camera :

Key       :  Privacy - Camera Usage Description   
Value     :  $(PRODUCT_NAME) camera use

Photo :

Key       :  Privacy - Photo Library Usage Description    
Value     :  $(PRODUCT_NAME) photo use
Nikunj Kumbhani
  • 3,758
  • 2
  • 26
  • 51