length property

int get length

The number of UTF-16 code units in this string, excluding the terminating NUL character.

This performs a linear scan until the first NUL code unit.

Implementation

int get length {
  final ptr = cast<WCHAR>();
  var length = 0;
  while (ptr[length] != 0) {
    length++;
  }
  return length;
}