createPicture method
Creates a picture of the current state of the DisplayObject. To ensure the "original" form, call before applying any transformations (x, y, scale, etc).
Optionally accepts prePaintCallback
and postPaintCallback
functions
that allow to customize the painting process.
Implementation
ui.Picture createPicture(
[void Function(ui.Canvas)? prePaintCallback,
void Function(ui.Canvas)? postPaintCallback]) {
final r = ui.PictureRecorder();
final c = ui.Canvas(r);
prePaintCallback?.call(c);
paint(c);
postPaintCallback?.call(c);
return r.endRecording();
}