Rect.fromPoints(Point a, Point b)

Construct the smallest rectangle that encloses the given points.

Source

Rect.fromPoints(Point a, Point b) {
  _value
    ..[0] = math.min(a.x, b.x)
    ..[1] = math.min(a.y, b.y)
    ..[2] = math.max(a.x, b.x)
    ..[3] = math.max(a.y, b.y);
}