allocateWString function

Pointer<NativeType> allocateWString(
  1. int count, {
  2. String? data,
  3. Allocator allocator = calloc,
})

Implementation

Pointer allocateWString(int count, { String? data,  Allocator allocator = calloc }) {
    if (Platform.isWindows) {
      Pointer<Uint16> buffer = allocator<Uint16>(count*2);
      if(data != null) {
        buffer.asTypedList(count*2).setAll(0, data.runes);
      }
      return buffer;
    }

    Pointer<Uint32> buffer = allocator<Uint32>(count*4);

    if(data != null) {
      buffer.asTypedList(count*2).setAll(0, data.runes);
    }

    return buffer;
}