canonicalD function

String canonicalD(
  1. MorphIconData icon
)

Canonical d attribute of an icon: a PathIcon's string verbatim, or a NodeIcon's real cubics quantized to 4 decimals.

Flutter never needs this to draw — MorphController.path carries exact curves. It exists for interop (handing a d to another SVG renderer) and because it is the string the web bindings would have painted, which is what makes cross-implementation comparison possible.

Implementation

String canonicalD(MorphIconData icon) {
  if (icon is PathIcon) return icon.d;
  return _canon[icon] ??= cubicsToPathD(_cubicsOf(icon));
}