nc-photos/app/lib/iterator_extension.dart

14 lines
251 B
Dart
Raw Normal View History

2022-01-25 11:08:13 +01:00
extension IteratorExtionsion<T> on Iterator<T> {
void iterate(void Function(T obj) fn) {
while (moveNext()) {
fn(current);
}
}
List<T> toList() {
final list = <T>[];
iterate((obj) => list.add(obj));
return list;
}
}