circularList<T> function

Iterable<T> circularList<T>(
  1. List<T> items, {
  2. int step = 1,
})

Implementation

Iterable<T> circularList<T>(List<T> items, {int step = 1}) sync* {
  int i = 0;
  while (true) {
    yield items[i % items.length];
    i += step;
  }
}