fromCode static method

NodeRole fromCode(
  1. String code
)

Deserialize from the single-character code in the endpoint name.

Implementation

static NodeRole fromCode(String code) {
  return NodeRole.values.firstWhere(
    (r) => r.code == code,
    orElse: () => NodeRole.group, // Safe default
  );
}