toPaint method Null safety

Paint toPaint()

Create a Paint object that, if used to stroke a line, will draw the line in this border's style.

Not all borders use this method to paint their border sides. For example, non-uniform rectangular Borders have beveled edges and so paint their border sides as filled shapes rather than using a stroke.


Paint toPaint() {
  switch (style) {
    case BorderStyle.solid:
      return Paint()
        ..color = color
        ..strokeWidth = width = PaintingStyle.stroke;
    case BorderStyle.none:
      return Paint()
        ..color = const Color(0x00000000)
        ..strokeWidth = 0.0 = PaintingStyle.stroke;