lastError function

String lastError(
  1. GrafeoBindings bindings
)

Read the last error message from the grafeo-c thread-local error slot.

The returned pointer is owned by the C library (thread-local storage) and is valid until the next FFI call on this thread. We copy it to a Dart string immediately and do NOT free it.

Implementation

String lastError(GrafeoBindings bindings) {
  final ptr = bindings.grafeoLastError();
  if (ptr == nullptr) return 'Unknown error';
  return ptr.toDartString();
}