pathToCoords static method

List<Offset> pathToCoords(
  1. Path path, [
  2. double pixelGap = 2
])

Implementation

static List<Offset> pathToCoords(Path path, [double pixelGap = 2]) {
  var metrics = path.computeMetrics();
  if (metrics.isEmpty) return [];

  var coords = <Offset>[];
  var metric = path.computeMetrics().first;

  double position = 0;
  while (position < metric.length) {
    var tangent = metric.getTangentForOffset(position);
    coords.add(tangent!.position);
    position += pixelGap;
  }

  return coords;
}