annotations property Null safety

List<CartesianChartAnnotation>? annotations
final

Customizes the annotations. Annotations are used to mark the specific area of interest in the plot area with texts, shapes, or images.

Widget build(BuildContext context) {
   return Container(
       child: SfCartesianChart(
           annotations: <CartesianChartAnnotation>[
               CartesianChartAnnotation(
                   child: Container(
                   child: const Text('Empty data')),
                   coordinateUnit: CoordinateUnit.point,
                   region: AnnotationRegion.chartArea,
                   x: 3.5,
                   y: 60
                ),
            ],
       ));
}

Implementation

final List<CartesianChartAnnotation>? annotations;