nullIfEmpty method Null safety

String? nullIfEmpty(
  1. String? str
)

Implementation

String? nullIfEmpty(String? str) => str?.isEmpty == true ? null : str;