rollbackAddingLastItem method

  1. @override
dynamic rollbackAddingLastItem()
override

Removes the last object in this list, but only intended for use during add and similar calls. The list is in general not supposed to have insert/remove operations available as explained in the documentation of the list itself.

Implementation

@override
rollbackAddingLastItem() {
  // Pretend the last element doesn't exist (decreases the length).
  _elementsCount--;

  // Overwrite the data with all zeroes (this will increase the length again).
  addByteData(ByteData(elementSizeInBytes));

  // Move the length backwars again.
  _elementsCount--;
}