toPointer function
Implementation
List toPointer(Uint8List units) {
final ffi.Pointer<ffi.Uint8> result = malloc.allocate<ffi.Uint8>(
units.length + 1,
);
final Uint8List nativeBytes = result.asTypedList(units.length + 1);
nativeBytes.setAll(0, units);
nativeBytes[units.length] = 0;
ffi.Pointer<ffi.Uint8> data = result.cast();
int dataLength = units.length;
return [data, dataLength];
}