# flatten<E> method

Iterable<E> flatten<E>(

1. E? selector(
   1. T item
   )

)

Transforms each element of the iterable into zero or more elements of type `E` and flattens the results.

Example:

    List<User> addons = [...];
    List<Card> cards = addons.flatten<Card>((e) => e.card).toList();

## Implementation

    Iterable<E> flatten<E>(E? Function(T item) selector) sync* {
      for (T item in this) {
        final E? result = selector(item);
        if (result != null) {
          yield result;
        }
      }
    }