toPaint method Null safety

Paint toPaint()

Create the Paint object that corresponds to this shadow description.

The offset is not represented in the Paint object. To honor this as well, the shape should be translated by offset before being filled using this Paint.

This class does not provide a way to disable shadows to avoid inconsistencies in shadow blur rendering, primarily as a method of reducing test flakiness. toPaint should be overridden in subclasses to provide this functionality.

Implementation

Paint toPaint() {
  return Paint()
    ..color = color
    ..maskFilter = MaskFilter.blur(BlurStyle.normal, blurSigma);
}