enumerate<T> function

Iterable<Enumerator<T?>> enumerate<T>(
  1. Iterable<T?> iterable
)

used as a Python enumerate function

Implementation

Iterable<Enumerator<T?>> enumerate<T>(Iterable<T?> iterable) sync* {
  var i = 0;
  for (var element in iterable) {
    yield Enumerator(i++, element);
  }
}