exportTraceToString method
Exports trace data to an output buffer (native behavior dependent).
Implementation
int exportTraceToString(String input) {
if (!_initialized) {
throw Exception('Not initialized');
}
if (!_symbolsAvailable) {
return -1;
}
final encoded = utf8.encode(input);
final len = encoded.isEmpty ? 1 : encoded.length;
final out = malloc<ffi.Uint8>(len);
try {
if (encoded.isNotEmpty) {
out.asTypedList(len).setAll(0, encoded);
} else {
out.value = 0;
}
final result = _otelExportTraceToStringPtr!
.asFunction<int Function(ffi.Pointer<ffi.Uint8>, int)>()(
out,
len,
);
if (result != 0) {
_captureNativeError();
}
return _legacySuccessCode(result);
} finally {
malloc.free(out);
}
}