DateTimeRange class
Represents a range of DateTime values.
This class allows defining a range with a start and end value, and whether the start and end are inclusive or exclusive.
Constructors
- DateTimeRange(DateTime? start, DateTime? end, {bool startInclusive = true, bool endInclusive = false})
- Creates a new DateTimeRange instance.
Properties
- endInclusive → bool
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startInclusive → bool
-
no setterinherited
Methods
-
compareTo(
Range< Comparable> other) → int -
Compares this range to another range. First compare starts of the ranges. If start
of this range is less than the start of the other, return -1, if it's greater, return 1.
If both starts are equal, compare ends of the ranges.
inherited
-
contains(
Object? obj) → bool -
Detect whether this range contains an element.
inherited
-
end(
{bool? inclusive}) → DateTime? -
Returns the end value of the range, optionally with inclusion overridden.
inherited
-
except(
Range< DateTime> that) → List<Range< DateTime> > -
The difference between two ranges is the set of all elements that are in this range but not in the other range.
inherited
-
format(
String fmt, String dateFormat, {String? locale, String? inclusiveTag, String? exclusiveTag, bool? startInclusive, bool? endInclusive}) → String - Formats the date range into a string using the specified format.
-
intersect(
Range< DateTime> that) → Range<DateTime> ? -
The intersection of two ranges is the set of all elements that are in both ranges.
inherited
-
isAdjacentTo(
Range< DateTime> that) → bool -
Test whether this range is adjacent to another range. The ranges are adjacent
if the end of this range is the same as the start of the other range or vice versa.
inherited
-
isSubsetOf(
Range< DateTime> that, {bool strict = false}) → bool -
Evaluate whether this range is a subset of another.
inherited
-
isSupersetOf(
Range< DateTime> that, {bool strict = false}) → bool -
Evaluate whether this range is a superset of another.
inherited
-
newInstance(
) → DateTimeRange -
Creates a new empty instance of the range.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overlaps(
Range< DateTime> that) → bool -
Check whether this range overlaps with another range.
inherited
-
start(
{bool? inclusive}) → DateTime? -
Returns the start value of the range, optionally with inclusion overridden.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
union(
Range< DateTime> that) → List<Range< DateTime> > -
The union of two ranges is the set of all elements that are in either range.
inherited
Operators
-
operator *(
Range< DateTime> that) → Range<DateTime> ? -
Operator for the intersection of this range and another range.
inherited
-
operator +(
Range< DateTime> that) → List<Range< DateTime> > -
Operator for the union of this range and another range.
inherited
-
operator -(
Range< DateTime> that) → List<Range< DateTime> > -
Operator for the difference between this range and another range.
inherited
-
operator ==(
Object that) → bool -
Ranges are equal if they have same start and end dates and inclusions.
inherited
Static Properties
- regexInfInf ↔ RegExp
-
Regular expression for a range from negative to positive infinity.
getter/setter pair
- regexInfVal ↔ RegExp
-
Regular expression for a range from negative infinity to a DateTime.
getter/setter pair
- regexValInf ↔ RegExp
-
Regular expression for a range from a DateTime to positive infinity.
getter/setter pair
- regexValVal ↔ RegExp
-
Regular expression for a range between two DateTimes.
getter/setter pair
Static Methods
-
listExcept(
List< DateTimeRange> source, List<DateTimeRange> exceptions) → List<DateTimeRange> - Creates a new list of DateTimeRange instances by excluding ranges from a source list.
-
parse(
String? input, {bool? startInclusive, bool? endInclusive}) → DateTimeRange? - Parses a string representation of a DateTime range.