ensureNotEmptyString function

String? ensureNotEmptyString(
  1. String? s, {
  2. bool trim = false,
  3. String? def,
})

If s isEmptyString will return def or null.

def Default value to return if s isEmptyString. trim Passed to isEmptyString.

Implementation

String? ensureNotEmptyString(String? s, {bool trim = false, String? def}) {
  if (isEmptyString(s, trim: trim)) {
    return def;
  }
  return s;
}