mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
13 lines
251 B
Dart
13 lines
251 B
Dart
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;
|
|
}
|
|
}
|