whereNotNull method

List<E> whereNotNull()

Returns a list containing only the non-null elements.

Example:

[1, null, 2, null].whereNotNull(); // [1, 2]

Implementation

List<E> whereNotNull() => <E>[for (final E? element in this) ?element];