ifEmpty method

String ifEmpty(
  1. String value
)

Return value if the current string is empty.

example

''.ifEmpty('This is empty!') // result: 'This is empty!'
String? uid; uid?.ifEmpty('UID is empty!') // result: null

Implementation

String ifEmpty(String value) => isEmpty ? value : this;