bounds property

Rect get bounds

Implementation

Rect get bounds {
  if (points.isEmpty) return Rect.zero;
  double left = points.first.dx;
  double top = points.first.dy;
  double right = left;
  double bottom = top;
  for (final Offset point in points) {
    left = min(left, point.dx);
    top = min(top, point.dy);
    right = max(right, point.dx);
    bottom = max(bottom, point.dy);
  }
  return Rect.fromLTRB(left, top, right, bottom);
}