canvas property Null safety
override
The canvas on which to paint.
The current canvas can change whenever you paint a child using this context, which means it's fragile to hold a reference to the canvas returned by this getter.
Implementation
@override
Canvas get canvas {
if (_canvas == null) {
_startRecording();
}
assert(_currentLayer != null);
return _canvas!;
}