@@ -4964,6 +4964,18 @@ enum ClipOp {
49644964///
49654965/// The current transform and clip can be saved and restored using the stack
49664966/// managed by the [save] , [saveLayer] , and [restore] methods.
4967+ ///
4968+ /// ## Use with the Flutter framework
4969+ ///
4970+ /// The Flutter framework's [RendererBinding] provides a hook for creating
4971+ /// [Canvas] objects ([RendererBinding.createCanvas] ) that allows tests to hook
4972+ /// into the scene creation logic. When creating a [Canvas] that will be used
4973+ /// with a [PictureLayer] as part of the [Scene] in the context of the Flutter
4974+ /// framework, consider calling [RendererBinding.createCanvas] instead of
4975+ /// calling the [new Canvas] constructor directly.
4976+ ///
4977+ /// This does not apply when using a canvas to generate a bitmap for other
4978+ /// purposes, e.g. for generating a PNG image using [Picture.toImage] .
49674979abstract class Canvas {
49684980 /// Creates a canvas for recording graphical operations into the
49694981 /// given picture recorder.
@@ -6415,6 +6427,19 @@ base class _NativePicture extends NativeFieldWrapperClass1 implements Picture {
64156427///
64166428/// To begin recording, construct a [Canvas] to record the commands.
64176429/// To end recording, use the [PictureRecorder.endRecording] method.
6430+ ///
6431+ /// ## Use with the Flutter framework
6432+ ///
6433+ /// The Flutter framework's [RendererBinding] provides a hook for creating
6434+ /// [PictureRecorder] objects ([RendererBinding.createPictureRecorder] ) that
6435+ /// allows tests to hook into the scene creation logic. When creating a
6436+ /// [PictureRecorder] and [Canvas] that will be used with a [PictureLayer] as
6437+ /// part of the [Scene] in the context of the Flutter framework, consider
6438+ /// calling [RendererBinding.createPictureRecorder] instead of calling the [new
6439+ /// PictureRecorder] constructor directly.
6440+ ///
6441+ /// This does not apply when using a canvas to generate a bitmap for other
6442+ /// purposes, e.g. for generating a PNG image using [Picture.toImage] .
64186443abstract class PictureRecorder {
64196444 /// Creates a new idle PictureRecorder. To associate it with a
64206445 /// [Canvas] and begin recording, pass this [PictureRecorder] to the
0 commit comments