svg library

The embedded SVG subset renderer package:device_preview uses to draw device bodies, exposed for reuse — tooling that previews device specs, or apps that draw a device frame themselves.

It has no dependencies beyond Flutter itself and covers only what device artwork needs: filled paths (plus rect, circle, ellipse, polygon), groups, transforms, and clip paths. See SvgDrawing for the exact subset.

A separate library so that apps which never touch it pay nothing for it.

Classes

SvgDrawing
A parsed, dependency-free rendering of a small SVG subset.
SvgShape
A single flattened, ready-to-paint shape of an SvgDrawing.
XmlElement
A parsed XML element: a name, its attributes, and its element children.

Functions

parseSvgPathData(String data, {PathFillType fillType = ui.PathFillType.nonZero}) Path
Parses the SVG path data grammar (the d attribute of <path>) into a ui.Path.
parseXmlDocument(String source) XmlElement
Parses source into its root XmlElement.