mapNonNull<R> method

Iterable<R> mapNonNull<R>(
  1. R mapper(
    1. T element
    )
)

Maps each non-null element using the provided mapper function.

Example:

Iterable<int?>? numbers = [null, 2, 3];
final mapped = numbers.mapNonNull((num) => num * 2);
print(mapped);  // Output: [4, 6]

Implementation

Iterable<R> mapNonNull<R>(R Function(T element) mapper) =>
    validate().map(mapper);