applyTo method

void applyTo(
  1. List<Item> list
)

Actually applies this operation on the list by mutating it.

Implementation

void applyTo(List<Item> list) {
  if (isInsertion) {
    list.insert(index, item);
  } else {
    assert(
      list[index] == item,
      "Tried to remove item $item at index $index, but there's a different "
      'item at that position: ${list[index]}.',
    );
    list.removeAt(index);
  }
}