dartora

LargeList

LargeList<VT, E> represents a potentially large, indexed collection of values derived from a backing map and an optional sequence of additional items. It implements Iterable<E>, providing random access and lazily transforms underlying data on the fly via a modifier function. Unlike LargeIterable, which only offers sequence semantics, LargeList exposes a full list‑like API (indexing, first, last, single, etc.) while avoiding unnecessary copying.

Construction

LargeList({
  required Map<String, VT> mapped,
  required List<String> keys,
  IterationHolder? extras,
  required E Function(VT e) modifier,
  int startIndex = 0,
  int? indexCount,
})

Properties

Iteration

LargeList’s iterator yields transformed values in order. The default iterator uses IndexBaseIterator, which calls elementAt(i) for each index.

Element access

Searching and checks

LargeList does not store values sequentially, so many search methods iterate explicitly:

Reduction

Transformations

Operations that would normally return an Iterable or List instead return a new LargeList or a standard List depending on semantics:

Conversion

toList({bool growable = true}) and toSet() return a materialised collection of the current view. Use these when a concrete list or set is needed.

Copying

LargeList.copy([...additionalItems]) creates a new LargeList with the same keys and map values but replaces the extras sequence by concatenating the existing extras with additional IterationLists. This is used internally by followedBy.

LargeList offers a flexible, windowed view over a map and extra items, making it ideal for representing search results, ordered keys and large datasets without copying data. Because all lookups funnel through elementAt and modifier, changes in the underlying map or extras are reflected in the view.