Interval class

An interval between two instants in time (start and end).

The interval includes the start instant and excludes the end instant. However, an interval may be missing its start or end, in which case the interval is deemed to be infinite in that direction.

The end may equal the start (resulting in an empty interval), but will not be before the start.

Annotations
  • @immutable

Constructors

Interval(Instant? start, 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.

Properties

end Instant
Gets the end instant - the exclusive upper bound of the interval.
no setter
hasEnd bool
Returns true if this interval has a fixed end point, or false if it extends to the end of time.
no setter
hashCode int
Returns the hash code for this instance.
no setteroverride
hasStart bool
Returns true if this interval has a fixed start point, or false if it extends to the start of time.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start Instant
Gets the start instant - the inclusive lower bound of the interval.
no setter
totalTime Time
Returns the duration of the interval.
no setter

Methods

contains(Instant instant) bool
Returns whether or not this interval contains the given instant.
equals(Interval other) bool
Indicates whether the value of this interval is equal to the value of the specified interval.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overlaps(Interval other) bool
Returns true if this Interval overlaps the other Interval.
toString() String
Returns a string representation of this interval, in extended ISO-8601 format: the format is 'start/end' where each instant uses a format of "uuuu'-'MM'-'dd'T'HH':'mm':'ss;FFFFFFFFF'Z'". If the start or end is infinite, the relevant part uses 'StartOfTime' or "EndOfTime" to represent this.
override

Operators

operator ==(Object other) bool
Implements the operator ==.
override