ListChangeRecord<E> class Null safety

A ChangeRecord that denotes adding or removing nodes at index.

It should be assumed that elements are removed before being added.

A List<ListChangeRecord> can be "played back" against the List using the final list positions to figure out which item was added - this removes the need to incur costly GC on the most common operation (adding).

Implemented types

Constructors

ListChangeRecord(List<E> object, int index, {List<E>? removed, int addedCount = 0})
factory
ListChangeRecord.add(List<E> object, int index, int addedCount)
Records an add operation at object[index] of addedCount elements.
ListChangeRecord.remove(List<E> object, int index, List<E> removed)
Records a remove operation at object[index] of removed elements.
ListChangeRecord.replace(List<E> object, int index, List<E> removed, [int? addedCount])
Records a replace operation at object[index] of removed elements.

Properties

added Iterable<E>
What elements were added to object.
read-only
addedCount int
How many elements were added at index (after removing elements).
final
hashCode int
The hash code for this object.
read-onlyoverride
index int
Index of where the change occurred.
final
object List<E>
List that changed.
final
removed List<E>
Elements that were removed starting at index (before adding elements).
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

apply(List<E> list) → void
Apply this change record to list.
indexChanged(int reference) bool
Returns whether reference index was changed in this operation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override