toggleSelection property Null safety

bool toggleSelection
final

Decides whether to deselect the selected item or not.

Provides an option to decide, whether to deselect the selected data point/series or remain selected, when interacted with it again.

If set to true, deselection will be performed else the point will not get deselected. This works even while calling public methods, in various selection modes, with multi-selection, and also on dynamic changes.

Defaults to true.

Widget build(BuildContext context) {
   return Container(
       child: SfCartesianChart(
           series: <BarSeries<SalesData, num>>[
               BarSeries<SalesData, num>(
                 selectionBehavior: SelectionBehavior(
                   enable: true,
                   toggleSelection: false,
                 ),
               ),
             ],
       ));
}

Implementation

final bool toggleSelection;