tryParse static method

AgentId? tryParse(
  1. String s
)

Validate and brand a string as AgentId. Matches format: a + optional <label>- + 16 hex chars. Returns null if the string doesn't match.

Implementation

static AgentId? tryParse(String s) {
  final pattern = RegExp(r'^a(?:.+-)?[0-9a-f]{16}$');
  return pattern.hasMatch(s) ? AgentId(s) : null;
}