title: Turn on location services without navigating to settings page ? Flutter Dart
body: <p>We are migrating from to Flutter. We used this thread to <a href="https://stackoverflow.com/questions/33251373/turn-on-location-services-without-navigating-to-settings-page?noredirect=1&amp;lq=1">Turn on location services without navigating to settings page</a></p>
  
  <p>How can this be achieved in Flutter?</p>
  
  <p>The current temporary code that navigates to settings:</p>
  
  <pre><code>  Future _getCurrentLocation() async {
      Position position;
      try {
        position = await Geolocator().getCurrentPosition(
            desiredAccuracy: LocationAccuracy.bestForNavigation);
      } on PlatformException catch(e){
        print(e.code);
        if(e.code =='PERMISSION_DISABLED'){
          print('Opening settings');
          await openLocationSetting();
          try {
            position = await Geolocator().getCurrentPosition(
                desiredAccuracy: LocationAccuracy.bestForNavigation);
          } on PlatformException catch(e){
            print(e.code);
          }
        }
      }
  
      setState(() {
  //      _center = LatLng(currentLocation['latitude'], currentLocation['longitude']);
        _center = LatLng(position.latitude, position.longitude);
      });
    }
    Future openLocationSetting() async {
      final AndroidIntent intent = new AndroidIntent(
        action: 'android.settings.LOCATION_SOURCE_SETTINGS',
      );
      await intent.launch();
  
    }
  </code></pre>