LocalId.parse constructor
LocalId.parse(
- String token
Parses a local id from its token (the inverse of toToken), ignoring
any leading readability prefix (n:, geo:, ...). Throws a
FormatException if it does not decode to 8 bytes.
Implementation
factory LocalId.parse(String token) {
final bytes = decodeBase32(_stripIdPrefix(token));
if (bytes.length != 8) {
throw FormatException('A LocalId token decodes to 8 bytes: $token');
}
final view = ByteData.view(bytes.buffer, bytes.offsetInBytes, 8);
return LocalId(
view.getUint32(0, Endian.big),
view.getUint32(4, Endian.big),
);
}