render library

Render a widget's painted output as a real vector document.

captureSvg and capturePdf replay a laid-out RenderObject's paint pass — no engine change, no compositing — into SVG or a single-page PDF; captureWidgetSvg/captureWidgetPdf/captureWidgetPng mount a widget offscreen first. Text stays text (or becomes glyph outlines read from the font file, per CaptureOptions.text); what no vector format can express follows CaptureOptions.unsupported: a raster patch, a flat stand-in, or nothing. The result's warnings list everything the output does not carry exactly as the engine would have drawn it.

The server-side story starts here too: render points are declared as typed values in a contract the app and the server share (re-exported below, and by package:flutterware/render_client.dart for the server), and the app binds implementations to them in a function marked RenderRegistry, receiving a RenderHost.

Classes

BoundDocumentRender<A>
BoundRender
One render point tied to its implementation. The args type is erased at this level; the json door re-enters it through the point's own codec.
BoundWidgetRender<A>
CaptureOptions
DocumentRender<A>
A render point that composes a whole PDF document itself — multi-page, flowing text, captured widget blocks dropped in as SVG.
OffscreenWidget
Mounts a widget in its own build/layout/paint pipeline, attached to no screen — the capture's way to render a widget that is not (and never will be) part of the running app's tree.
PdfResult
PngResult
RenderBindings
The registrar's bindings, collected: what this registry can render.
RenderContext
What a builder runs against: the request's compiled options and fonts, and in-process capture — the seam a document builder uses to drop a widget block into its pw layout as SVG.
RenderFont
A font file the writers may embed or read glyph outlines from, matched to runs by family + bold/italic.
RenderHost
What the registrar receives: bind each declared render point to its implementation.
RenderOptions
The wire form of the export policies: plain data, serializable, compiled by the guest to its per-run callback form.
RenderPoint<A>
A named entry the render guest can produce, with its args type pinned.
RenderRegistry
Marks the one function fw render bundle compiles as the guest's registrar:
RenderSize
A logical size, kept free of any Flutter dependency.
RenderWarning
One honest statement about something the rendered output does not carry exactly as the engine would have drawn it.
SvgResult
TextCluster
TextRun
WidgetRender<A>
A render point that builds a widget; the caller chooses the output — SVG, PNG, or a single-page PDF — and the options.

Enums

RenderWarningKind
TextPolicy
What to do with a text run.
UnsupportedPolicy
What to do with an op the writer cannot express (shadows, unresolvable shaders, layer effects, paragraphs whose text could not be recovered).

Functions

capturePdf(RenderObject render, {Size? size, List<RenderFont> fonts = const [], CaptureOptions? options}) → Future<PdfResult>
Captures render's painted content as a single-page PDF.
captureSvg(RenderObject render, {Size? size, List<RenderFont> fonts = const [], CaptureOptions? options}) → Future<SvgResult>
Captures render's painted content as a self-contained SVG.
captureWidgetPdf(Widget widget, {required Size size, List<RenderFont> fonts = const [], CaptureOptions? options}) → Future<PdfResult>
Renders widget offscreen at size and captures it as a single-page PDF.
captureWidgetPng(Widget widget, {required Size size, double pixelRatio = 3}) → Future<PngResult>
Renders widget offscreen at size and rasterizes it — the camera lane, so its only possible warning is the widget throwing on the way to the picture.
captureWidgetSvg(Widget widget, {required Size size, List<RenderFont> fonts = const [], CaptureOptions? options}) → Future<SvgResult>
Renders widget offscreen at size and captures it as SVG — the widget-first door for widgets that are not part of any running tree.
runRenderDriver(void registrar(RenderHost host)) → Future<void>
Runs the render guest: loads the bundle's fonts, runs registrar, and serves render requests over stdio until stdin closes.