CustomPaint constructor Null safety

const CustomPaint(
  1. {Key? key,
  2. CustomPainter? painter,
  3. CustomPainter? foregroundPainter,
  4. Size size,
  5. bool isComplex,
  6. bool willChange,
  7. Widget? child}
)

Creates a widget that delegates its painting.

Implementation

const CustomPaint({
  Key? key,
  this.painter,
  this.foregroundPainter,
  this.size = Size.zero,
  this.isComplex = false,
  this.willChange = false,
  Widget? child,
}) : assert(size != null),
     assert(isComplex != null),
     assert(willChange != null),
     assert(painter != null || foregroundPainter != null || (!isComplex && !willChange)),
     super(key: key, child: child);