unparse static method

String unparse(
  1. List<int> buffer, {
  2. int offset = 0,
})

Unparses a buffer of bytes and outputs a proper UUID string. An optional offset is allowed if you want to start at a different point in the buffer. Throws an exception if the buffer does not have a length of 16

Implementation

static String unparse(List<int> buffer, {int offset = 0}) {
  if (buffer.length != 16) {
    throw Exception('The provided buffer needs to have a length of 16.');
  }
  var i = offset;
  return '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}'
      '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}-'
      '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}-'
      '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}-'
      '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}-'
      '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}'
      '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}'
      '${_byteToHex[buffer[i++]]}${_byteToHex[buffer[i++]]}';
}