highestRolePriority function

int highestRolePriority(
  1. Iterable<String> assignedRoles,
  2. Map<String, ServerRoleDefinition> roles
)

Implementation

int highestRolePriority(
  Iterable<String> assignedRoles,
  Map<String, ServerRoleDefinition> roles,
) {
  int? highest;
  for (final role in assignedRoles) {
    final priority = roles[role]?.priority;
    if (priority != null && (highest == null || priority > highest)) {
      highest = priority;
    }
  }
  return highest ?? 0;
}