toNative method
[int32 len][payload] in alloc'd memory — one copy, no views.
Implementation
Pointer<Uint8> toNative(Allocator alloc) {
final len = payloadLength;
final ptr = alloc<Uint8>(4 + len);
ptr.cast<Int32>().value = len; // every supported target is little-endian
copyPayloadTo(ptr.asTypedList(4 + len), 4);
return ptr;
}