copyToNative method

Pointer<Char> copyToNative({
  1. Allocator allocator = malloc,
})

Copies a Uint8List into native memory as a char*.

Returns an allocator-allocated pointer to the result.

Implementation

Pointer<Char> copyToNative({Allocator allocator = malloc}) {
  final Pointer<Uint8> result = allocator<Uint8>(length)
    ..asTypedList(length).setAll(0, this);
  return result.cast();
}