arePermissionsGranted method

Future<bool> arePermissionsGranted()
inherited

Does this probe has the permissions needed to run?

Implementation

Future<bool> arePermissionsGranted() async {
  // fast out if no permissions to check
  if (permissions.isEmpty) return true;

  debug('$runtimeType - Checking permission for: $permissions');
  bool granted = true;

  try {
    for (var permission in permissions) {
      granted = granted && await permission.isGranted;
    }
  } catch (error) {
    warning(
        '$runtimeType - Error trying to check permissions, error: $error');
    return false;
  }
  return granted;
}