record method Null safety
Returns a widget that renders a widget in a box that can be recorded.
The returned widget wraps child
in a box with a fixed size specified by
frameSize. The key
is also applied to the returned widget.
The frame is only recorded if the recording
argument is true, or during
a procedure that is wrapped within recording
. In either case, the
painted result of each frame will be stored and later available for
display. If neither condition is met, the frames are not recorded, which
is useful during setup phases.
The child
must not be null.
See also:
- WidgetTester.pumpFrames, which renders a widget in a series of frames with a fixed time interval.
Implementation
Widget record(Widget child, {
Key? key,
bool recording = true,
}) {
assert(child != null);
return _AnimationSheetRecorder(
key: key,
size: frameSize,
allLayers: allLayers,
handleRecorded: recording ? _recordedFrames.add : null,
child: child,
);
}