InteractiveParserDelegate class abstract

Abstract delegate responsible for loading and parsing SVG assets for interactive usage.

Implementations must:

  • load SVG content in loadAssets (this prepares internal parsing context, viewBox, etc.),
  • return a mapping of selectors to rendered SVG fragments via parseSvg,
  • compute hit-test paths for touchable regions via parseSvgBounds,
  • transform SVG coordinate-space bounds into widget/render space via scaleSvgBounds.

Important semantics:

  • loadAssets MUST be awaited before calling parseSvg or parseSvgBounds.
  • parseSvg returns a RegionList where the null key holds the base/full SVG string.
  • parseSvgBounds returns a BoundsList mapping selectors to SvgBounds in the SVG's native coordinate system (viewBox). Use scaleSvgBounds to convert those paths into the coordinate space of the rendered widget, providing size, fit and alignment.
  • isChanged should return true when the delegate's inputs (e.g., asset path or selectors) differ from another instance, so callers know to reload resources.

Constructors

InteractiveParserDelegate()

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasTouchableItem → bool
Returns true if there is at least one touchable item in the SVG.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

isChanged(covariant InteractiveParserDelegate other) → bool
Checks if this parser delegate is different from other.
loadAssets(BuildContext context) → Future<void>
Loads SVG assets and prepares the parsing context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseSvg() → RegionList
Parses the SVG and returns a map of region labels to SvgRegion objects.
parseSvgBounds() → BoundsList
Returns a map of touchable path bounds for interactive objects.
scaleSvgBounds(BoundsList boundsList, {Size size = Size.zero, Alignment alignment = Alignment.topLeft, BoxFit fit = BoxFit.contain}) → BoundsList
Scales a set of BoundsList entries from SVG coordinate space (viewBox) into the target widget coordinate space (size) using fit and alignment.
toString() → String
A string representation of this object.
inherited

Operators

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