expand<T> method
inherited
Expands each element of this Iterable into zero or more elements.
The resulting Iterable runs through the elements returned by f
for each element of this, in iteration order.
The returned Iterable is lazy, and calls f
for each element of this every time it's iterated.
Example:
var pairs = [[1, 2], [3, 4]]; var flattened = pairs.expand((pair) => pair).toList(); print(flattened); // => [1, 2, 3, 4]; var input = [1, 2, 3]; var duplicated = input.expand((i) => [i, i]).toList(); print(duplicated); // => [1, 1, 2, 2, 3, 3]
Implementation
Iterable<T> expand<T>(Iterable<T> f(String element)) => readClasses().expand<T>(f);
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-svg/AttributeClassSet/expand.html