Check if obj has value (isn't null or empty).
obj
bool hasValue(Object? obj) { if (obj is Iterable) { return obj.isNotEmpty; } return obj != null && obj.toString().isNotEmpty; }