encodeCString static method
Encodes s as NUL-terminated UTF-8 bytes (not yet in the heap — copy in
via a WasmArena or writeBytes).
Implementation
static Uint8List encodeCString(String s) {
final utf8 = const Utf8Encoder().convert(s);
final out = Uint8List(utf8.length + 1);
out.setRange(0, utf8.length, utf8);
return out;
}