toXML method

  1. @override
String toXML()
override

Convert the Svg structure to XML string

Implementation

@override
String toXML() {
  final start = _polarToCartesian(cx, cy, r, endAngle);
  final startX = start[0];
  final startY = start[1];

  final end = _polarToCartesian(cx, cy, r, startAngle);
  final endX = end[0];
  final endY = end[1];

  final largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1';

  return '<path ${attributes(id, fill, stroke, strokeWidth, strokeDasharray, style, transform, unit, visibility)} '
      'd="M ${roundPixelsOnly(startX)} ${roundPixelsOnly(startY)} '
      'A ${roundPixelsOnly(r)} ${roundPixelsOnly(r)} 0 $largeArcFlag 0 $endX $endY '
      'L ${roundPixelsOnly(cx)} ${roundPixelsOnly(cy)}"/>';
}