onLegendItemRender property Null safety

ChartLegendRenderCallback? onLegendItemRender
final

Occurs when the legend item is rendered. Here, you can get the legend’s text, shape, series index, and point index of circular series.

Widget build(BuildContext context) {
   return Container(
       child: SfCartesianChart(
           legend: Legend(isVisible: true),
           onLegendItemRender: (LegendRenderArgs args) => legend(args)
       ));
}
void legend(LegendRenderArgs args) {
  args.seriesIndex = 2;
}

Implementation

final ChartLegendRenderCallback? onLegendItemRender;