1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-11 16:15:35 +01:00
lemmur-app-android/lib/util/extensions/iterators.dart

8 lines
205 B
Dart
Raw Normal View History

2020-09-14 23:54:47 +02:00
extension ExtraIterators<E> on Iterable<E> {
2020-09-30 19:05:00 +02:00
/// A `.map` but with an index as the second argument
2020-09-14 23:54:47 +02:00
Iterable<T> mapWithIndex<T>(T f(E e, int i)) {
var i = 0;
return map((e) => f(e, i++));
}
}