If I run the following code:
Uint8List bytes = Uint8List.fromList([1, 0, 0, 128]);
ByteBuffer byteBuffer = bytes.buffer;
Uint16List sixteenBitList = byteBuffer.asUint16List();
print(sixteenBitList);
I get the following result:
[1, 32768]
Since the original values were
00000001 00000000 00000000 10000000
1 0 0 128
I would have expected them to be combined like this:
0000000100000000 0000000010000000
256 128
Instead, I got this:
0000000000000001 1000000000000000
1 32768
That's little endian, right? I'm running this code on my Mac. Is the reason I got the result above because my Mac uses little endian? If I ran the same code on a big endian computer, would it give a different result? (I get the same result on DartPad, but I don't know what machine DartPad is running on.)