nativeString function

String? nativeString(
  1. Pointer<Char> value, {
  2. bool emptyIsNull = false,
})

Copies Google's C string, or null for a null pointer. With emptyIsNull, an empty string is null too, as Google's Python reads optional strings.

Implementation

String? nativeString(Pointer<Char> value, {bool emptyIsNull = false}) {
  if (value == nullptr) return null;
  final text = value.cast<Utf8>().toDartString();
  return emptyIsNull && text.isEmpty ? null : text;
}