buildCubicPath function

Path buildCubicPath(
  1. List<CubicPath> paths
)

Builds the exact cubic path of a normalized icon — the at-rest shape.

Implementation

ui.Path buildCubicPath(List<CubicPath> paths) {
  final path = ui.Path();
  for (final p in paths) {
    final pts = p.pts;
    if (pts.length < 8) continue;
    path.moveTo(pts[0], pts[1]);
    for (var i = 2; i < pts.length; i += 6) {
      path.cubicTo(
        pts[i],
        pts[i + 1],
        pts[i + 2],
        pts[i + 3],
        pts[i + 4],
        pts[i + 5],
      );
    }
    if (p.closed) path.close();
  }
  return path;
}