Interval constructor

Interval(
  1. Instant? start,
  2. Instant? end
)

Initializes a new instance of the Interval struct. The interval includes the start instant and excludes the end instant. The end may equal the start (resulting in an empty interval), but must not be before the start.

  • start: The start Instant.

  • end: The end Instant.

  • ArgumentOutOfRangeException: end is earlier than start.

Implementation

Interval(Instant? start, Instant? end)
    : _start = start ?? IInstant.beforeMinValue,
      _end = end ?? IInstant.afterMaxValue {
  if (_end < _start) {
    throw RangeError(
        'The end parameter must be equal to or later than the start parameter');
  }
}