rangeContainsRange function
Whether or not subrange
is fully contained by range
.
Inclusive, and treats a null range.start
, range.end
, subrange.start
,
subrange.end
as unbounded.
Implementation
bool rangeContainsRange(DateRange range, DateRange subrange) {
final containsStart = (range.start == null && subrange.start == null) ||
(subrange.start != null && rangeContains(range, subrange.start));
final containsEnd = (range.end == null && subrange.end == null) ||
(subrange.end != null && rangeContains(range, subrange.end));
return containsStart && containsEnd;
}