flatten method

Iterable<E> flatten()

Returns a new lazy Iterable of all elements from all collections in this collection.

var nestedList = List([[1, 2, 3], [4, 5, 6]]);
var flattened = nestedList.flatten(); // [1, 2, 3, 4, 5, 6]

Implementation

Iterable<E> flatten() sync* {
  for (var current in this) {
    yield* current;
  }
}