update method

  1. @override
void update(
  1. Key key,
  2. T newItem, {
  3. bool merge = false,
})
override

Updates an item.

Implementation

@override
void update(Key key, T newItem, {bool merge = false}) {
  final oldItem = findByKey(key);
  if (oldItem == null) return;

  final oldBounds = logic.getBounds(oldItem);
  final newBounds = logic.getBounds(newItem);

  // Incremental Update
  _itemCache[key] = newItem;
  spatialIndex.update(key, newItem, oldBounds, newBounds);

  perform(logic.createUpdateOp(oldItem, newItem), merge: merge, notify: true);
  _emit(ItemUpdated(oldItem, newItem));
  scheduleAutoSave();
}