operator & method

Range operator &(
  1. Range otherRange
)
inherited

Gets the intersection between two ranges, range nil if they don't intersect

Implementation

Range operator &(Range otherRange) {
  final start = max(this.start, otherRange.start);
  final end = min(this.end, otherRange.end);
  if (start >= end) {
    return Range(end, end);
  }
  return Range(start, end);
}