dartora

IterationItem

IterationItem is a simple, read‑only implementation of the Iteration mixin. It wraps any Iterable<E> and exposes a windowed view into it defined by startIndex and indexTake. Unlike IterationBase, it does not implement the List<E> interface and provides no mutation methods; it is purely for iteration and slicing.

Constructor

IterationItem({
  required Iterable<E> source,
  int startIndex = 0,
  int indexTake = 0,
})

Implementation

IterationItem stores the source and implements the abstract members of Iteration:

Because IterationItem does not implement List<E>, it inherits only the read‑only methods of Iteration. It is useful for converting arbitrary iterables into the Iteration framework so that they can participate in windowing, mapping and slicing operations.

Usage

You rarely instantiate IterationItem directly. It is returned internally by methods like map, followedBy and expand on other Iteration types to wrap the resulting sequences back into an Iteration. It can also be used to adapt any Iterable so that windowing and searching operations are available.