takeSnapshot method
Immediately take a snapshot and return it. If renderSnapshot is true then the snapshot is also used for rendering. A snapshot is always taken with no transformations (i.e. as if the Snapshot component is at position (0, 0) and has no scale or rotation applied).
Implementation
Picture takeSnapshot() {
final recorder = PictureRecorder();
final canvas = Canvas(recorder);
final matrix = transformMatrix.clone();
matrix.invert();
canvas.transform(matrix.storage);
super.renderTree(canvas);
_picture = recorder.endRecording();
return _picture!;
}