Interval class

An interval between optional start and end instants.

An interval can be closed (both start and end set), open (both start and end are not set), open ended (only start) or open started (only end).

Intervals include the start instant and exclude the end instant.

Inheritance
Annotations
  • @immutable

Constructors

Interval(Instant? start, Instant? end)
An interval between optional start (inclusive) and end (exclusive).
const
Interval.closed(DateTime start, DateTime end)
A closed interval between start (inclusive) and end (exclusive).
factory
Interval.fromJson(Iterable data)
Creates an interval from data containing two String? items (start, end).
factory
Interval.open()
A fully open interval with start and end set to null.
const
Interval.openEnd(DateTime start)
An open ended interval starting from the start instant (inclusive).
factory
Interval.openStart(DateTime end)
Creates an open started interval ending to the end instant (exclusive).
factory
Interval.parse(String text)
An interval of a string ("../
factory

Properties

duration Duration?
A duration (difference) between start and end if both are available.
no setter
end Instant?
The end instant, or null if the the interval is open ended.
no setter
endTime DateTime?
The end instant as DateTime, or null if the the interval is open ended.
no setter
hashCode int
The hash code for this object.
no setteroverride
isClosed bool
True if the interval is closed (both start and end are non null).
no setter
isOpen bool
True if the interval is open (both start and end are null).
no setter
isUtc bool
True if this temporal object is set to UTC time.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start Instant?
The start instant, or null if the interval is open started.
no setter
startTime DateTime?
The start instant as DateTime, or null if the interval is open started.
no setter

Methods

copyWith({Instant? start, Instant? end}) Interval
Copy this inteval with optional start and/or end instants changed.
isAfterTime(DateTime time) bool
Returns true if this occurs fully after time.
override
isBeforeTime(DateTime time) bool
Returns true if this occurs fully before time.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this temporal object.
override
toUtc() Interval
Returns this temporal object in the UTC time zone.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

tryParse(String text) Interval?
An interval of a string ("../