painter property Null safety

CustomPainter? painter

The background custom paint delegate.

This painter, if non-null, is called to paint behind the children.

Implementation

CustomPainter? get painter => _painter;
void painter=(CustomPainter? value)

Set a new background custom paint delegate.

If the new delegate is the same as the previous one, this does nothing.

If the new delegate is the same class as the previous one, then the new delegate has its CustomPainter.shouldRepaint called; if the result is true, then the delegate will be called.

If the new delegate is a different class than the previous one, then the delegate will be called.

If the new value is null, then there is no background custom painter.

Implementation

set painter(CustomPainter? value) {
  if (_painter == value)
    return;
  final CustomPainter? oldPainter = _painter;
  _painter = value;
  _didUpdatePainter(_painter, oldPainter);
}