unpack16 function

int unpack16(
  1. dynamic inp,
  2. int offset,
  3. Endian endian
)

Unpacks a 16 bit integer from a byte buffer. The inp parameter can be an Uint8List or a ByteData if you will run it several times against the same buffer and want faster execution.

Implementation

int unpack16(dynamic inp, int offset, Endian endian) {
  if (inp is! ByteData) {
    inp = ByteData.view(
        inp.buffer as ByteBuffer, inp.offsetInBytes as int, inp.length as int?);
  }
  return inp.getUint16(offset, endian);
}