ifEmpty method
If the provided String
is empty do something.
Example
String foo = '';
foo.ifEmpty(()=>print('String is empty'));
Implementation
String? ifEmpty(Function act) {
if (this == null) {
return null;
}
return this!.trim().isEmpty ? act() : this;
}