getMostLeftPoint method Null safety

Point<num> getMostLeftPoint(
  1. List<Point<num>> polygon
)

Get the furthest left point of the polygon

Implementation

static Point getMostLeftPoint(List<Point> polygon) {
  assert(polygon.length >= 3);
  var mostLeftPoint = Point<num>(double.infinity, double.infinity);

  for (var p in polygon) {
    if (p.x < mostLeftPoint.x) {
      mostLeftPoint = p;
    }
  }

  return mostLeftPoint;
}