ifEmpty method

String ifEmpty([
  1. String value = 'null'
])

Returns a default value if the string is empty.

@param value The default value to return if the string is empty. Defaults to 'null'. @return The original string if not empty, otherwise the default value.

Implementation

String ifEmpty([String value = 'null']) => trim().isEmpty ? value : this;