parse static method
The identity in name, or null when name has another shape.
Implementation
static GroupIdentity? parse(String? name) {
if (name == null) return null;
// the port id can be negative, so the last part may start with `-`
RegExpMatch? match = _shape.firstMatch(name);
if (match == null) return null;
int? id = int.tryParse(match.group(1)!);
int? count = int.tryParse(match.group(2)!);
int? port = int.tryParse(match.group(3)!);
if (id == null || count == null || port == null) return null;
if (id < 2 || count < id) return null;
return GroupIdentity(id, count, port);
}