createRenderer method Null safety

StackedColumn100SeriesRenderer createRenderer(
  1. ChartSeries<T, D> series
)

Create the stacked area series renderer.

Implementation

StackedColumn100SeriesRenderer createRenderer(ChartSeries<T, D> series) {
  StackedColumn100SeriesRenderer stackedAreaSeriesRenderer;
  if (onCreateRenderer != null) {
    stackedAreaSeriesRenderer =
        onCreateRenderer!(series) as StackedColumn100SeriesRenderer;
    // ignore: unnecessary_null_comparison
    assert(stackedAreaSeriesRenderer != null,
        'This onCreateRenderer callback function should return value as extends from ChartSeriesRenderer class and should not be return value as null');
    return stackedAreaSeriesRenderer;
  }
  return StackedColumn100SeriesRenderer();
}