ifNull method Null safety

String? ifNull(
  1. Function act
)

If the provided String is null do something.

Example

String foo = ''
foo.ifEmpty(()=>print('String is null'));

Implementation

String? ifNull(Function act) {
  if (this != null) {
    return this;
  }

  return act();
}