ifEmpty method

String ifEmpty(
  1. Function act
)

If the provided String is empty do something.

Example

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

Implementation

String ifEmpty(Function act) {
  return this.trim().isEmpty ? act() : this;
}