intersection method
Returns the intersection of this range list and the other
range list;
otherwise null.
Implementation
RangeList? intersection(RangeList other) {
if (!intersect(other)) {
return null;
}
if (this == other) {
return RangeList(this.start, this.end);
}
var start = this.start;
if (other.start > start) {
start = other.start;
}
var end = this.end;
if (other.end < end) {
end = other.end;
}
return RangeList(start, end);
}