flatten<R> method

List<R> flatten<R>()

Flattens a List<List<R>> into a List<R>.

[[1,2],[3,4]].flatten<int>() // [1,2,3,4]

Implementation

List<R> flatten<R>() {
  if (this is! List<List<R>>) {
    throw UnsupportedError('flatten<R> requires a List<List<R>>');
  }
  return (this as List<List<R>>).expand((e) => e).toList();
}