updateIndex method
Updates the spatial index based on the operation.
getItem allows retrieving the current state of an item by key (useful for Move ops).
Implementation
@override
void updateIndex(SpatialIndex<Marker> index, Op<Marker> op,
Marker? Function(Key) getItem) {
switch (op) {
case AddMarkerOp(:final marker):
index.add(marker.key!, marker, getBounds(marker));
case RemoveMarkerOp(:final key):
index.remove(key);
case MoveMarkerOp(:final key):
final item = getItem(key);
if (item != null) index.add(key, item, getBounds(item));
case UpdateMarkerOp(:final newMarker):
index.add(newMarker.key!, newMarker, getBounds(newMarker));
}
}