key property

ValueKey<String>? key

Key to identify a series in a collection.

On specifying ValueKey as the series key, existing series index can be changed in the series collection without losing its state.

When a new series is added dynamically to the collection, existing series index will be changed. On that case, the existing series and its state will be linked based on its chart type and this key value.

Defaults to null.

Widget build(BuildContext context) {
   return Container(
       child: SfPyramidChart(
           series: PyramidSeries<SalesData, num>(
                     key: const ValueKey<String>('line_series_key'),


final ValueKey<String>? key;