arePermissionsGranted method

Future<bool> arePermissionsGranted()
inherited

Whether all permissions are granted. Returns false if checking fails.

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) {
    addError('$runtimeType - Error trying to check permissions, error: $error');
    return false;
  }
  return granted;
}