toUint16List method

Uint16List? toUint16List(
  1. int length
)

Creates a Uint16List from this pointer by copying the pointer's data.

length is the length of the array.

null is returned if the pointer is equal to nullptr.

Implementation

Uint16List? toUint16List(int length) {
  if (this == nullptr) {
    return null;
  }
  final Uint16List list = Uint16List(length);
  for (int i = 0; i < length; i++) {
    list[i] = this[i];
  }
  return list;
}