batchUpdate method

void batchUpdate(
  1. VoidCallback updates
)

Coalesce multiple controller mutations into one listener notification.

Selection/export streams still emit their events as the mutations happen, but chart repaint listeners are notified once after the outermost batch.

Implementation

void batchUpdate(VoidCallback updates) {
  if (_disposed) return;
  _notificationBatchDepth++;
  try {
    updates();
  } finally {
    _notificationBatchDepth--;
    _flushPendingNotificationIfNeeded();
  }
}