Collection Methods
map, where, reduce, fold, any, every and sort transform collections. map and where return lazy iterables, so call toList().
Example
void main() {
var n = [1, 2, 3, 4, 5, 6];
print(n.map((x) => x * 2).toList());
print(n.where((x) => x.isEven).toList());
print(n.reduce((a, b) => a + b));
}Exercise
Keep matching items.
n.((x) => x > 2)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.