parse static method

AgentOrigin parse(
  1. String wire
)

The origin named wire, or a refusal. Anything but local-agent is refused rather than mapped: a network origin must not be constructible by a typo, a configuration key or a test hook.

Implementation

static AgentOrigin parse(String wire) {
  for (final origin in values) {
    if (origin.wire == wire) return origin;
  }
  throw ArgumentError.value(
    wire,
    'origin',
    'is not an agent origin this surface admits (only "local-agent")',
  );
}