getFillPaint method Null safety

  1. @override
Paint getFillPaint()
override

Gets the color of the series.

Implementation

@override
Paint getFillPaint() {
  fillPaint = Paint();
  if (_series.gradient == null) {
    if (_color != null) {
      fillPaint!.color = _color!;
      fillPaint!.style = PaintingStyle.fill;
    }
  } else {
    fillPaint = (_pathRect != null)
        ? _getLinearGradientPaint(_series.gradient!, _pathRect!,
            _seriesRenderer._chartState!._requireInvertedAxis)
        : fillPaint;
  }
  assert(_series.opacity >= 0,
      'The opacity value of the range area series should be greater than or equal to 0.');
  assert(_series.opacity <= 1,
      'The opacity value of the range area series should be less than or equal to 1.');
  fillPaint!.color =
      (_series.opacity < 1 && fillPaint!.color != Colors.transparent)
          ? fillPaint!.color.withOpacity(_series.opacity)
          : fillPaint!.color;
  _defaultFillColor = fillPaint;
  return fillPaint!;
}