TagHandle.named constructor
TagHandle.named(
- String name
name is a valid non-empty tag uri. Any !, {, }, [, or ]
must be encoded as 2 hex characters preceded by the %.
Implementation
factory TagHandle.named(String name) {
assert(name.isNotEmpty, 'Name cannot be empty!');
for (final (index, char) in name.runes.indexed) {
if (!char.isAlphaNumeric()) {
throw FormatException(
'Non-alphanumeric characters are not allowed',
name,
index,
);
}
}
final prefix = tag.asString();
return TagHandle._(TagHandleVariant.named, '$prefix$name$prefix');
}