startBatchUpdate method

void startBatchUpdate()

Starts a batch update session for this reactive instance.

During a batch update, changes to the value are buffered and not immediately sent to listeners. This is useful when you need to make multiple changes to the value and only want to notify listeners once at the end.

Batch updates can be nested. The buffered updates will only be published when the outermost batch update is ended with endBatchUpdate.

Example usage:

// Start batching updates
reactive.startBatchUpdate();

// Make multiple changes
reactive.value = 10;
reactive.value = 20;
reactive.value = 30;

// End batching and publish the final update
reactive.endBatchUpdate();

See also:

Implementation

void startBatchUpdate() {
  _batchUpdateCounter++;
}