syncSelection method

void syncSelection(
  1. ChartSelection? selection
)

Synchronize selection state without firing user tap callbacks.

Use this from controller bridges/sync groups when another chart is the interaction source. The onSelectionChanged stream and listeners still receive the state change.

Implementation

void syncSelection(ChartSelection? selection) {
  if (_disposed) return;
  final nextSelection = selection?.snapshot();
  if (_selection == nextSelection) return;
  _selection = nextSelection;
  _emitSelection(nextSelection);
  _notifyIfAlive();
}