widget property Null safety

Widget? widget
final

Considers any widget as annotation.

Defaults to null

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

Implementation

final Widget? widget;