batch method

void batch(
  1. void operations()
)

Executes multiple operations in a batch.

Index updates are deferred until the batch completes, improving performance for bulk operations.

index.batch(() {
  for (final node in movedNodes) {
    index.update(node);
  }
});

Implementation

void batch(void Function() operations) {
  _inBatch = true;
  try {
    operations();
  } finally {
    _inBatch = false;
    _grid.flushPendingUpdates();
    _notifyChanged();
  }
}