dartora

LargeIterable

LargeIterable<VT, E> provides a lazy sequence of values from a keyed map with optional extras, viewed through a transformation function. It implements the Iteration<E> mixin, which means it supports windowing via startIndex and indexTake and can be composed into larger iterables without copying data.

Purpose

Often you have a Map<String, VT> and a list of keys that defines the order in which values should be presented. You may also have an optional list of extra objects to append after all keys. LargeIterable turns this combination into an Iteration<E> where each value is lazily converted from VT to E using a modifier callback. This is used heavily by LargeList and ChildHolder to support efficient mapping over large data sets.

Construction

LargeIterable({
  required Map<String, VT> mapped,
  required List<String> keys,
  Iterable<dynamic>? extras,
  required E Function(VT e) modifier,
  int startIndex = 0,
  int indexTake = 0,
})

Internal fields

The class stores the map (_mapped), the key list (_keys), any extras (_extras) and the modifier. It also stores the public startIndex and indexTake values from Iteration.

Length and key count

LargeIterable exposes two length properties:

Iteration

When iterated, LargeIterable uses an IteratorBuild<E> whose elementAt reads values from the map or extras depending on the index. The range is from 0 up to sourceLength.

Access methods

Contains check

containsKey(Object? key) returns true if the string key exists within the visible window and false otherwise.

Transformations

LargeIterable implements many of the methods defined by Iteration:

Notes

LargeIterable is read‑only: there are no methods to insert, remove or modify the backing map or keys. If you need to modify the underlying data, adjust the map/keys/extras and create a new LargeIterable.