checkPermission method

  1. @override
Future<LocationPermission> checkPermission()

Returns a Future indicating if the user allows the App to access the device's location.

Note: on the web platform not all browsers implement the Permission API if this is the case the LocationPermission.unableToDetermine is returned as the plugin cannot determine the if permissions are granted or denied.

Implementation

@override
Future<LocationPermission> checkPermission() async {
  try {
    // ignore: omit_local_variable_types
    final int permission =
        await _methodChannel.invokeMethod('checkPermission');

    return permission.toLocationPermission();
  } on PlatformException catch (e) {
    final error = _handlePlatformException(e);

    throw error;
  }
}