To pick a photo, use the native photo picker instead of asking for gallery permission. It opens outside the app, the user picks a photo, and the app gets only that photo, the rest of the library stays private. So there's no permission dialog, no "Allow access to all your photos", no going to Settings after a deny.
image_picker uses it on iOS out of the box. On Android turn it on once at startup:
final ImagePickerPlatform picker = ImagePickerPlatform.instance;if (picker is ImagePickerAndroid) { picker.useAndroidPhotoPicker = true;}
Then picking is one line, with no permission code around it:
final XFile? photo = await ImagePicker().pickImage( source: .gallery,);
Ask for gallery permission only when the app needs the whole library, like a backup app.