onCreateShader property Null safety

CartesianShaderCallback? onCreateShader
final

Fills the data points with the gradient and image shaders.

The data points of pie, doughnut and radial bar charts can be filled with gradient (linear, radial and sweep gradient) and image shaders.

All the data points are together considered as a single segment and the shader is applied commonly.

Defaults to null.

    Widget build(BuildContext context) {
   return Scaffold(
       body: Center(
           child: Container(
                 child: SfCartesianChart(
series: <BarSeries<SalesData, num>>[
               BarSeries<SalesData, num>(
                    onCreateShader: (ShaderDetails details)
         {
          return ui.Gradient.linear(details.rect.topRight,
           details.rect.bottomLeft, [Colors.yellow, Colors.lightBlue, Colors.brown], [0.2,0.6,1]);
         },
               ),
                     ]
                )
             )
         )
     );
 }

Implementation

final CartesianShaderCallback? onCreateShader;