title: Flutter permission_handler package not opening app settings when permission is permanently denied
body: <p>Have been working on the permission_handler package for sometime. Trying to figure out the app settings page on ios or android when user permanently denies access for the app.</p>
  <p>My app to begin with needs access to the media library and the camera. Experienced flutter devs please explain in detail if possible. I am a newbie to flutter development and newbie the whole mobile application development as well.</p>
  <p>Here is podfile on ios</p>
  <pre><code>post_install do |installer|
    installer.pods_project.targets.each do |target|
      flutter_additional_ios_build_settings(target)
      target.build_configurations.each do |config|
              config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
                 '$(inherited)',
  
                 ## dart: PermissionGroup.calendar
                 'PERMISSION_EVENTS=0',
  
                 ## dart: PermissionGroup.reminders
                 'PERMISSION_REMINDERS=0',
  
                 ## dart: PermissionGroup.contacts
                 # 'PERMISSION_CONTACTS=0',
  
                 ## dart: PermissionGroup.camera
                 # 'PERMISSION_CAMERA=1',
  
                 ## dart: PermissionGroup.microphone
                 # 'PERMISSION_MICROPHONE=0',
  
                 ## dart: PermissionGroup.speech
                 'PERMISSION_SPEECH_RECOGNIZER=0',
  
                 ## dart: PermissionGroup.photos
                 # 'PERMISSION_PHOTOS=1',
  
                 ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
                 'PERMISSION_LOCATION=0',
  
                 ## dart: PermissionGroup.notification
                 # 'PERMISSION_NOTIFICATIONS=0',
  
                 ## dart: PermissionGroup.mediaLibrary
                 # 'PERMISSION_MEDIA_LIBRARY=1',
  
                 ## dart: PermissionGroup.sensors
                  'PERMISSION_SENSORS=0'
               ]
      end
    end
  end
  </code></pre>
  <p>Here is the info.plist-</p>
  <pre><code>&lt;key&gt;NSPhotoLibraryUsageDescription&lt;/key&gt;
      &lt;string&gt;This app requires access to your photo gallery to view or save images&lt;/string&gt;
      &lt;key&gt;NSPhotoLibraryAddUsageDescription&lt;/key&gt;
      &lt;string&gt;&lt;/string&gt;
  </code></pre>
  <p>Here is my actual code, on button press I am checking if permission is there to open gallery</p>
  <pre><code>TextButton.icon(
      icon: const Icon(
         Icons.photo_library_rounded,
            size: 50,
          ),
     label: const Text('Pick from gallery',
        style: TextStyle(fontSize: 20)),
      onPressed: () {
        PermissionService().openPhotoGallery();
       },
  ),
  </code></pre>
  <p>Here is my permissions class. The app doesn't open the app settings instead it just loads up the settings on ios.</p>
  <pre><code>import 'package:permission_handler/permission_handler.dart';
  
  class PermissionService {
  
    openPhotoGallery() async {
      var galleryAccessStatus = await Permission.mediaLibrary.status;
      if(!galleryAccessStatus.isGranted) {
        var status = await Permission.mediaLibrary.request();
        if(status.isPermanentlyDenied) {
          await openAppSettings();
        }
      }
    }
  }
  </code></pre>
  <p>Adding this snip after viewing Zeeyans answer. The openAppSettings does not open the app settings page instead it opens the Settings page.
  <a href="https://i.stack.imgur.com/EcofQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EcofQ.png" alt="enter image description here" /></a></p>