DocumentId.parse constructor

DocumentId.parse(
  1. String token
)

Parses a document id from its base32 token (the inverse of toToken). Throws a FormatException if it does not decode to 16 bytes.

Implementation

factory DocumentId.parse(String token) {
  final bytes = decodeBase32(_stripIdPrefix(token));
  if (bytes.length != 16) {
    throw FormatException('A DocumentId token decodes to 16 bytes: $token');
  }
  return DocumentId(bytes);
}