mapIfEmpty method
Returns this string if it has a value, otherwise returns the provided str.
This method provides a default value when the string is null or empty.
Example:
String? name;
print(name.mapIfEmpty('Unknown')); // prints: Unknown
Implementation
String mapIfEmpty(String str) {
return isNullOrEmpty ? str : this!;
}