whereNotNull method

Iterable<T> whereNotNull()

The non-null elements of this Iterable.

Returns an iterable which emits all the non-null elements of this iterable, in their original iteration order.

For an Iterable<X?>, this method is equivalent to .whereType<X>().

Implementation

Iterable<T> whereNotNull() sync* {
  for (var element in this) {
    if (element != null) yield element;
  }
}