getHorizontalLine function

List<List<double>> getHorizontalLine(
  1. List<List<double>> points
)

Implementation

List<List<double>> getHorizontalLine(List<List<double>> points) {
  for (int i = 0, j = 1; j < points.length; i++, j++) {
    final p1 = points[i], p2 = points[j];
    if (p1[1] == p2[1]) return [p1, p2];
  }
  return [];
}