trimmedOrNull function

String? trimmedOrNull(
  1. Object? input
)

Converts the input to a string if it's not null and trims it or returns null if the result is empty.

Implementation

String? trimmedOrNull(Object? input) {
  final a = input?.toString().trim();
  final b = a?.isEmpty == true ? null : a;
  return b;
}