onSelectionChanged property Null safety

ChartSelectionCallback? onSelectionChanged

Occurs while selection changes. Here, you can get the series, selected color, unselected color, selected border color, unselected border color, selected border width, unselected border width, series index, and point index.

Widget build(BuildContext context) {
   return Container(
       child: SfCartesianChart(
           onSelectionChanged: (SelectionArgs args) => print(args.selectedColor),


final ChartSelectionCallback? onSelectionChanged;