checkPermission method
Returns a Future<LocationPermission> indicating if the user allows the
App to access the device's location
If onlyCheckBackground is true, only check background location permission.
even if the App already has the 'whileInUse' permission, it still will return
'denied' or 'deniedForever' if the App doesn't have the 'always' permission.
Throws a PermissionDefinitionsNotFoundException when there is no permission description in the AndroidManifest.xml on Android or the Info.plist on iOS.
Implementation
@override
Future<LocationPermission> checkPermission(
{bool onlyCheckBackground = false}) async {
try {
final params = <String, dynamic>{
'onlyCheckBackground': onlyCheckBackground
};
final int permission =
await methodChannel.invokeMethod(Methods.checkPermission, params);
return permission.toLocationPermission();
} on PlatformException catch (e) {
final error = _handlePlatformException(e);
throw error;
}
}