toCString for an optional argument: nullptr for null (the FFI reads NULL as "absent"). Callers still free a non-NULL result.
nullptr
Pointer<Utf8> toCStringOrNull(String? s) => s == null ? nullptr : toCString(s);