addDashGap method

void addDashGap(
  1. PathMetric metric,
  2. double dashGapLength
)

Implementation

void addDashGap(ui.PathMetric metric, double dashGapLength) {
  // Calculate lengths (actual + available)
  final end = _calculateLength(metric, _remainingDashGapLength);
  final availableEnd = _calculateLength(metric, dashGapLength);
  // Move path's end point
  ui.Tangent tangent = metric.getTangentForOffset(end)!;
  path.moveTo(tangent.position.dx, tangent.position.dy);
  // Update
  final delta = end - extractedPathLength;
  _remainingDashGapLength = _updateRemainingLength(
    delta: delta,
    end: end,
    availableEnd: availableEnd,
    initialLength: dashGapLength,
  );
  extractedPathLength = end;
  _previousWasDash = false;
}