key property
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: SfCircularChart(
series: <PieSeries<SalesData, num>>[
PieSeries<SalesData, num>(
key: const ValueKey<String>('pie_series_key'),
),
],
));
}
Implementation
///
///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`.
///
///```dart
///Widget build(BuildContext context) {
/// return Container(
/// child: SfCircularChart(
/// series: <PieSeries<SalesData, num>>[
/// PieSeries<SalesData, num>(
/// key: const ValueKey<String>('pie_series_key'),
/// ),
/// ],
/// ));
///}
///```
final ValueKey<String>? key;