Rect? rectForRange(int start, int end) { Rect? union; for (final Rect rect in rectsForRange(start, end)) { union = union == null ? rect : union.expandToInclude(rect); } return union; }