flatten<E> method
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;
}
}
}