nullFilteredSet<T> function
Converts input
to a Set with non-null elements if T
is non-null.
Implementation
Set<T> nullFilteredSet<T>(Iterable<dynamic> input) {
final filtered = input.toSet()..retainWhere((e) => (null is T || e != null));
return filtered.cast();
}