title: Flutter Permissions Handler Not Working Properly
body: <p>I am trying to get the user's location from within my app by requesting for permission(shows dialog correctly) and navigating only if granted. Library being used <code>permission_handler</code> in flutter. I am unable to get the location widget from the settings tile menu to turn on and permission status from library is showing <code>permission.disabled</code>. </p>
  
  <p>I have opened the settings tile programmatically for my app
  and it's listed and active like below block:</p>
  
  <pre><code>void _requestPerms () async{
  Map&lt;PermissionGroup, PermissionStatus&gt; statuses = await PermissionHandler().requestPermissions([
    PermissionGroup.locationWhenInUse, PermissionGroup.locationAlways
  ]);
  final status = statuses[PermissionGroup.locationWhenInUse];
  switch(status){
    case PermissionStatus.disabled:
      await PermissionHandler().openAppSettings();
      break;
  }
  _updateStatus(status);
  </code></pre>
  
  <p>}</p>
  
  <p>Can someone help me understand why despite getting the dialog prompt once, the phone location widget is not turning on and how to navigate to next route on condition of <code>permission granted</code> or exit the app gracefully if not. Thanks.</p>
  
  <p>Full Code:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:eme_clone/utils/styles.dart';
  import 'package:eme_clone/utils/constants.dart';
  import 'package:permission_handler/permission_handler.dart';
  
  class LocationDialog extends StatefulWidget {
    @override
     _LocationDialogState createState() =&gt; _LocationDialogState();
    }
  
  class _LocationDialogState extends State&lt;LocationDialog&gt; {
  
  PermissionStatus _status;
  
  @override
  void initState() {
    super.initState();
    PermissionHandler().checkPermissionStatus(PermissionGroup.locationWhenInUse)
      .then(_updateStatus);
  }
  
  @override
  Widget build(BuildContext context) {
  debugPrint('Location Status $_status');
  return Scaffold(
    body: SafeArea(
        child: Column(
          children: &lt;Widget&gt;[
            Image.asset('assets/images/perm_icon_location.png'),
            Text(
              locationDialogHeader,
              style: locationHeaderStyle,
            ),
            Padding(
              padding: const EdgeInsets.all(10.0),
              child: Text(
                locationDialogBody,
                textAlign: TextAlign.center,
                style: locationTextBodyStyle,
              ),
            ),
            Expanded(
              child: Align(
                alignment: FractionalOffset.bottomCenter,
                child: Container(
                  width: double.infinity,
                  padding: EdgeInsets.all(10.0),
                  child: RaisedButton(
                    color: Colors.black,
                    onPressed: _requestPerms,
                    padding: EdgeInsets.only(top: 15.0, bottom: 15.0),
                      child: Text(
                        allow,
                        style: allowBtnTextStyle,
                      ),
                    ),
                  ),
                ),
              )
            ],
          )),
    );
  }
  
  void _updateStatus(PermissionStatus value) {
    setState(() {
      _status = value;
    });
  }
  
  void _requestPerms () async{
    Map&lt;PermissionGroup, PermissionStatus&gt; statuses = await PermissionHandler().requestPermissions([
    PermissionGroup.locationWhenInUse, PermissionGroup.locationAlways
  ]);
    final status = statuses[PermissionGroup.locationWhenInUse];
    switch(status){
      case PermissionStatus.disabled:
       await PermissionHandler().openAppSettings();
       break;
    }
    _updateStatus(status);
  }
  </code></pre>
  
  <p>}</p>