toPointer method

Pointer<WChar> toPointer({
  1. Allocator allocator = malloc,
})

Implementation

Pointer<WChar> toPointer({Allocator allocator = malloc}) {
  final units = codeUnits;
  final result = allocator<Int32>(units.length + 1);
  final nativeString = result.asTypedList(units.length + 1);
  nativeString.setRange(0, units.length, units);
  nativeString[units.length] = 0;
  return result.cast();
}