expand method is equivalent to flatMap in Dart.
[1,2,3].expand((e) => [e, e+1])
What is more interesting, the returned Iterable is lazy, and calls fuction for each element every time it’s iterated.
expand method is equivalent to flatMap in Dart.
[1,2,3].expand((e) => [e, e+1])
What is more interesting, the returned Iterable is lazy, and calls fuction for each element every time it’s iterated.