toDartString method

String toDartString({
  1. int? length,
})

Converts this PWSTR to a Dart string.

If length is provided, exactly that many UTF-16 code units are decoded, allowing embedded NUL characters to be preserved.

If length is omitted, decoding stops at the first terminating NUL.

Implementation

String toDartString({int? length}) {
  if (length != null) RangeError.checkNotNegative(length, 'length');
  return .fromCharCodes(cast<WCHAR>().asTypedList(length ?? this.length));
}