parseSvgPathData function

void parseSvgPathData(
  1. String? d,
  2. SvgPathSink sink
)

Parses d — the value of an SVG <path d="…"> attribute — and drives sink with the normalized drawing commands. Relative coordinates, smooth and quadratic curves, and elliptical arcs are all resolved down to absolute moveTo / lineTo / cubicTo / close. A null or empty d emits nothing.

Implementation

void parseSvgPathData(String? d, SvgPathSink sink) {
  if (d == null || d.isEmpty) return;
  final scanner = _PathScanner(d);
  final normalizer = _PathNormalizer();
  for (final segment in scanner.parseSegments()) {
    normalizer.emitSegment(segment, sink);
  }
}