asUint16List method Null safety
Creates a Uint16List view of a region of this byte buffer.
The view is backed by the bytes of this byte buffer.
Any changes made to the
Uint16List will also change the buffer,
and vice versa.
The viewed region start at
offsetInBytes, which must be 16-bit aligned,
length 16-bit integers with
the same endianness as the host (Endian.host).
length is omitted, the range extends as far towards the end of
the buffer as possible -
if lengthInBytes is not even, the last byte can't be part of the view.
The start index and length must describe a valid 16-bit aligned range of the buffer:
offsetInBytesmust not be negative,
offsetInBytesmust be divisible by two,
lengthmust not be negative, and
offsetInBytes + length * 2must not be greater than lengthInBytes.
Uint16List asUint16List([int offsetInBytes = 0, int? length]);