SvgParserState class

The implementation of SvgParser.

Maintains state while pushing an XmlPushReader through the SVG tree.

Constructors

SvgParserState(Iterable<XmlEvent> events, SvgTheme theme, String? _key, bool _warningsAsErrors)
Creates a new SvgParserState.

Properties

attributes Map<String, String>
The XML Attributes of the current node in the tree.
no setter
currentGroup DrawableParent?
The current group, if any, in the Drawable heirarchy.
no setter
depth int
The current depth of the reader in the XML hierarchy.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
rootBounds Rect
The root bounds of the drawable.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
theme SvgTheme
The theme used when parsing SVG elements.
final

Methods

addGroup(XmlStartElementEvent event, DrawableParent? drawable) → void
Appends a group to the collection.
addShape(XmlStartElementEvent event) bool
Appends a DrawableShape to the currentGroup.
applyTransformIfNeeded(Path? path) Path?
Applies a transform to a path if the attributes contain a transform.
attribute(String name, {String? def}) String?
Gets the attribute for the current position of the parser.
buildUrlIri() String
Builds an IRI in the form of 'url(#id)'.
checkForIri(DrawableStyleable? drawable) bool
Whether this DrawableStyleable belongs in the DrawableDefinitions or not.
endElement(XmlEndElementEvent event) → void
Handles the end of an XML element.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse() Future<DrawableRoot>
Drive the XmlTextReader to EOF and produce a DrawableRoot.
parseClipPath() List<Path>?
Parses a clipPath element into a list of Paths.
parseColor(String? colorString, {Color? currentColor}) Color?
Converts a SVG Color String (either a # prefixed color string or a named color) to a Color.
parseDashArray() → CircularIntervalList<double>?
Parses an @stroke-dasharray attribute into a CircularIntervalList.
parseDashOffset() → DashOffset?
Parses a @stroke-dashoffset into a DashOffset.
parseDoubleWithUnits(String? rawDouble, {bool tryParse = false}) double?
Parses a rawDouble String to a double taking into account absolute and relative units (px, em or ex).
parseFill(Rect bounds, DrawablePaint? parentFill, Color? defaultFillColor, Color? currentColor) DrawablePaint?
Parses a fill attribute.
parseFillRule([String attr = 'fill-rule', String? def = 'nonzero']) PathFillType?
Parses a fill-rule attribute into a PathFillType.
parseFontSize(String? raw, {double? parentValue}) double?
Parses a font-size attribute.
parseFontStyle(String? fontStyle) FontStyle?
Parses a font-style attribute value into a FontStyle.
parseFontWeight(String? fontWeight) FontWeight?
Parses a font-weight attribute value into a FontWeight.
parseMask() DrawableStyleable?
Lookup the mask if the attribute is present.
parseOpacity() double?
Parses an @opacity value into a double, clamped between 0..1.
parseStroke(Rect bounds, DrawablePaint? parentStroke, Color? currentColor) DrawablePaint?
Parses a @stroke attribute into a Paint.
parseStyle(Rect bounds, DrawableStyle? parentStyle, {Color? defaultFillColor, Color? currentColor}) DrawableStyle
Parses style attributes or @style attribute.
parseTextDecoration(String? textDecoration) TextDecoration?
Parses a text-decoration attribute value into a TextDecoration.
parseTextDecorationStyle(String? textDecorationStyle) TextDecorationStyle?
Parses a text-decoration-style attribute value into a TextDecorationStyle.
parseTileMode() TileMode
Parses a spreadMethod attribute into a TileMode.
parseViewBox({bool nullOk = false}) DrawableViewport?
Parses an SVG @viewBox attribute (e.g. 0 0 100 100) to a Rect.
startElement(XmlStartElementEvent event) bool
Potentially handles a starting element.
toString() String
A string representation of this object.
inherited
unhandledElement(XmlStartElementEvent event) → void
Prints an error for unhandled elements.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

emptyUrlIri → const String
An empty IRI.
kCssPixelsPerInch → const int
The number of pixels per CSS inch.
kCssPointsPerInch → const int
The number of points per CSS inch.
kPointsToPixelFactor → const double
The multiplicand to convert from CSS points to pixels.