flatMapNotNull<R extends Object> method

Iterable<R> flatMapNotNull<R extends Object>(
  1. Iterable<R?> transform(
    1. T
    )
)

flatMap that discards nulls from the produced iterables.

['hello', 'hi', 'world']
    .flatMapNotNull((s) => [s.startsWith('h') ? s.toUpperCase() : null]);
// ('HELLO', 'HI')

Implementation

Iterable<R> flatMapNotNull<R extends Object>(
  Iterable<R?> Function(T) transform,
) => expand(transform).whereType<R>();