nullIfBlank function

String? nullIfBlank(
  1. String value
)

Swap {@code null} for blank text values.

@param value an input string that may or may not be entirely whitespace @return {@code null} if the string is entirely whitespace, otherwise the input value

Implementation

String ? nullIfBlank(String value) {
  if (isBlank(value)) {
    return null;
  }
  return value;
}