dartora

MultiViewList

MultiViewList<E> is a lightweight wrapper around a Dart list that exposes the same read/write behaviour but allows multiple views to share the same underlying storage. It converts any Iterable<E> into a list on construction and provides an unmodifiable view when needed. The primary goal is to support the ordered‑map keys lists used by OrderedMap and to allow slicing and filtering operations to return new MultiViewList instances without copying the entire list.

Construction

MultiViewList<E>({ required Iterable<E> source })

Internally the class stores:

Core properties and iteration

MultiViewList implements Iterable<E>, so you can iterate over it directly. It provides:

Searching

Mutation

Although most of dartora’s collection types are immutable views, MultiViewList is mutable. You can:

Reduction

Standard reduction methods from Iterable are delegated to the backing list:

View transformations

View‑oriented methods return new MultiViewList instances wrapping a transformed List:

Converting back to standard collections

MultiViewList is intentionally simple: it is mostly a façade over List that returns new MultiViewList instances when an operation would otherwise return a plain list. This preserves the ability for OrderedMap and ChildHolder to build multiple views without reallocating memory.