pack16 function
Packs a 16 bit integer into a byte buffer. The out
parameter can be an Uint8List or a
ByteData if you will run it several times against the same buffer and want faster execution.
Implementation
void pack16(int x, dynamic out, int offset, Endian endian) {
assert((x >= 0) && (x <= _MASK_16));
if (out is! ByteData) {
out = ByteData.view(out.buffer, out.offsetInBytes, out.length);
}
out.setUint16(offset, x, endian);
}