As Seth said, you want a ByteData view of the Uint8List binary data.
It is slightly better to use ByteBuffer.asByteData() . It is a little more concise and works better for testing. If you have a Uint8List layout and mock ByteBuffer, new ByteData.view(buffer) will fail, but the mock ByteBuffer asByteData() method can be made to return mock ByteData.
var bytes = myUint8List.buffer.asByteData(); bytes.getUint16(offset);
With perfect foresight, we will only have asByteData (), not the redundant public ByteData.view constructor.
source share