combine method
Returns a rectangle by combining all of the rectangles
Implementation
Rect combine() {
final rects = this;
if (rects.isEmpty) return Rect.zero;
final boundary = rects.fold(
(
left: double.maxFinite,
top: double.maxFinite,
right: double.minPositive,
bottom: double.minPositive
),
(a, c) => (
left: min(a.left, c.left),
top: min(a.top, c.top),
right: max(a.right, c.right),
bottom: max(a.bottom, c.bottom)
));
return Rect.fromLTRB(
boundary.left, boundary.top, boundary.right, boundary.bottom);
}