checkPermission function
Checks if a specific permission has been granted.
This method verifies the current status of the specified permission without requesting it from the user.
Parameters:
p: The KruzrPermission to check the status for.
Returns: A Future<bool> that resolves to:
trueif the permission is already grantedfalseif the permission is not granted or denied
Example:
bool hasLocationPermission = await checkPermission(KruzrPermission.location);
if (hasLocationPermission) {
// Permission is granted, proceed with location-based features
}
Implementation
Future<bool> checkPermission(KruzrPermission p) async {
final bool? res = await platform.invokeMethod<bool>('checkPermission', {
'permission': p.name,
});
return res ?? false;
}