intersection abstract method

  1. @useResult
Range<T>? intersection(
  1. Range<T> other
)

If this intersects other, returns the intersection. Otherwise returns null.

See intersects for determining if two ranges intersect.

final foo = Interval.open(1, 5);
final bar = Interval.closed(3, 7);

foo.intersection(bar); // [3..5), { x | 3 <= x < 5 }


Min.open(5).intersection(Min.closed(7)); // [7..+∞)

Max.open(5).intersection(Max.closed(7)); // (-∞..5)

Interval.open(1, 5).intersection(Interval.open(7, 9)); // null

Implementation

@useResult Range<T>? intersection(Range<T> other);