toCStringOrNull function

Pointer<Utf8> toCStringOrNull(
  1. String? s
)

toCString for an optional argument: nullptr for null (the FFI reads NULL as "absent"). Callers still free a non-NULL result.

Implementation

Pointer<Utf8> toCStringOrNull(String? s) => s == null ? nullptr : toCString(s);