PathSegment.parse constructor
PathSegment.parse(
- String raw
Reads raw as whichever segment form it is written in.
Implementation
factory PathSegment.parse(String raw) {
if (_catchAll.firstMatch(raw) case final match?) {
return CatchAllSegment(match.group(1)!);
}
if (_constrained.firstMatch(raw) case final match?) {
return ConstrainedSegment(match.group(1)!, match.group(2)!);
}
if (_plain.firstMatch(raw) case final match?) {
return ParameterSegment(match.group(1)!);
}
return LiteralSegment(raw);
}