length method
0 - fastest, raw accuracy 1 - slowest, most accurate
Implementation
double? length({double accuracy: 0.1}) {
final steps = (accuracy * 100).toInt();
if (steps <= 1) {
return _distance;
}
double length = 0.0;
Offset prevPoint = start;
for (int i = 1; i < steps; i++) {
final t = i / steps;
final next = point(t);
length += prevPoint.distanceTo(next);
prevPoint = next;
}
return length;
}