unparse static method
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 a RangeError exception if the buffer is not large enough to hold the bytes. That is, if the length of the buffer after the offset is less than 16.
Implementation
static String unparse(List<int> buffer, {int offset = 0}) {
if (buffer.length - offset < 16) {
throw RangeError('buffer too small: need 16: length=${buffer.length}'
'${offset != 0 ? ', offset=$offset' : ''}');
}
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++]]}';
}