extension IteratorExtionsion on Iterator { void iterate(void Function(T obj) fn) { while (moveNext()) { fn(current); } } List toList() { final list = []; iterate((obj) => list.add(obj)); return list; } }