toNative method

Pointer<Uint8> toNative(
  1. Allocator alloc
)

Encode this map to a native buffer wrapped in the RecordWriter 4B envelope.

The returned pointer is owned by alloc and must not be freed separately when using an Arena (the Arena frees it on scope exit).

Implementation

Pointer<Uint8> toNative(Allocator alloc) {
  final w = RecordWriter();
  writeTo(w);
  return w.toNative(alloc);
}