defaultValue method Null safety

String? defaultValue(
  1. String defautlValue
)

Provide default value if the String is null.

Example

String? foo = null;
foo.ifNull('dont be null'); // returns 'dont be null'

Implementation

String? defaultValue(String defautlValue) {
  if (this != null) {
    return this;
  }
  return defautlValue;
}