nullIfEmpty method

String? nullIfEmpty()

Null when null or "". name.nullIfEmpty()

Implementation

String? nullIfEmpty() => (this ?? "").isEmpty ? null : this;