PathSegment constructor
PathSegment(
- String name
Automatically create ArgumentSegment or NamedSegment.
For ArgumentSegment, name must be starts with ":" or wrapped with "{}"
Implementation
factory PathSegment(String name) {
if (name.startsWith(":") || (name.startsWith("{") && name.endsWith("}"))) {
String _name;
if (name.startsWith(":")) {
_name = name.substring(1, name.length);
} else {
_name = name.substring(1, name.length - 1);
}
return ArgumentSegment(_name);
} else {
return NamedSegment(name);
}
}