count function

Iterable<int> count(
  1. int start, {
  2. int step = 1,
})

Make an iterator that returns evenly spaced values starting with number start.

count(5, step: 2) // 5, 7, 9, 11, ...

Implementation

Iterable<int> count(int start, {int step = 1}) sync* {
  while (true) {
    yield start;
    start += step;
  }
}