base64DecompressUuid function

String base64DecompressUuid(
  1. String id
)

Implementation

String base64DecompressUuid(String id) {
  var base64 = id.replaceAll('.', '-');
  final paddingNeeded = base64.length % 4;

  if (paddingNeeded != 0) {
    base64 += '=' * (4 - paddingNeeded);
  }

  final bytes = Uint8List.fromList(base64Url.decode(base64));

  if (bytes.length != 16) {
    throw FormatException('invalid uuid length');
  }

  return _formatUuidFromHex(_bytesToHex(bytes));
}