checkPermission function

Future<bool> checkPermission(
  1. KruzrPermission p
)

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:

Returns: A Future<bool> that resolves to:

  • true if the permission is already granted
  • false if 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;
}