captureSvg function
Future<SvgResult>
captureSvg(
- RenderObject render, {
- Size? size,
- List<
RenderFont> fonts = const [], - CaptureOptions? options,
Captures render's painted content as a self-contained SVG.
render must be laid out — typically a RenderRepaintBoundary found
through a GlobalKey, in a test or a running app. size defaults to the
box's own size. The result's warnings say what the vector output does not
carry exactly (raster patches, dropped effects, unrecovered text).
Implementation
Future<SvgResult> captureSvg(
RenderObject render, {
Size? size,
List<RenderFont> fonts = const [],
CaptureOptions? options,
}) async {
var opts = options ?? CaptureOptions();
var recording = await _capture(render, opts);
var svg = writeSvg(recording, size ?? _sizeOf(render), fonts, options: opts);
return SvgResult(svg, recording.collectWarnings(opts));
}