dartora

IterationBase

IterationBase is an abstract class that extends the Iteration mixin and implements Dart’s List<E> interface. It provides a mutable, list‑like view over an underlying collection while still supporting the windowing capabilities of Iteration. Concrete subclasses (such as IterationList, IterationHolder and ImmutableIterationHolder) supply the low‑level storage and implement the hooks for insertion and removal; IterationBase orchestrates index adjustments and delegates to these hooks.

Construction

IterationBase({
  int startIndex = 0,
  int indexTake = 0,
})

startIndex and indexTake define the visible window in the same way as described in Iteration. Concrete subclasses must also implement the following abstract members:

List API

IterationBase implements or forwards most methods of List<E>:

View operations

IterationBase returns new mutable views rather than copying data:

Notes

Because IterationBase implements the full List<E> interface, it can be passed to APIs expecting a mutable list. However, heavy lifting (such as insertion, removal and range replacement) is delegated to concrete subclasses, which must manage their own storage and length tracking. This separation of concerns allows IterationHolder to operate on multiple sublists, IterationList to operate on a single list, and ImmutableIterationHolder to provide a read‑only concatenation, all while sharing the same high‑level list API.