orEmpty method

String orEmpty()

Returns the string or an empty string if null.

Example:

String? name = null;
print(name.orEmpty()); // ''

Implementation

String orEmpty() {
  return this ?? "";
}