Rectangle.fromPoints constructor
Create a rectangle from two opposite corner points
Implementation
factory Rectangle.fromPoints(Point a, Point b) {
final minX = math.min(a.x, b.x);
final minY = math.min(a.y, b.y);
final w = (a.x - b.x).abs();
final h = (a.y - b.y).abs();
return Rectangle(x: minX, y: minY, width: w, height: h);
}