nullIfBlank property

String? get nullIfBlank

Returns null when this string is null, empty, or only whitespace.

Implementation

String? get nullIfBlank {
  final value = this?.trim();
  return value == null || value.isEmpty ? null : value;
}