diff --git a/sdk/lib/framework/rendering/box.dart b/sdk/lib/framework/rendering/box.dart index 98fe65bc99240aace6b2d98dbf40132b90320e09..563dd423527dec6990fcc367fec2e61da51e172d 100644 --- a/sdk/lib/framework/rendering/box.dart +++ b/sdk/lib/framework/rendering/box.dart @@ -680,14 +680,20 @@ class RenderCustomPaint extends RenderProxyBox { CustomPaintCallback _callback; void set callback (CustomPaintCallback value) { - assert(value != null); + assert(value != null || !attached); if (_callback == value) return; _callback = value; markNeedsPaint(); } + void attach() { + assert(_callback != null); + super.attach(); + } + void paint(RenderObjectDisplayList canvas) { + assert(_callback != null); _callback(canvas); super.paint(canvas); }