union method

Rect union(
  1. Rect other
)

Returns a rectangle that contains both this rectangle and other.

Implementation

Rect union(Rect other) {
  final x1 = math.min(x, other.x);
  final y1 = math.min(y, other.y);
  final x2 = math.max(right, other.right);
  final y2 = math.max(bottom, other.bottom);
  return Rect.fromLTWH(x1, y1, x2 - x1, y2 - y1);
}