DateRange class
Represents a range of dates.
This class extends Range and provides specific functionality for working with date ranges. It supports inclusive and exclusive boundaries, parsing from string representations, and formatting date ranges.
Constructors
Properties
- endInclusive → bool
-
no setterinherited
- first → DateTime
-
The first element.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
DateTime> -
Returns an iterator over the elements in this range.
Throws an exception if the range is not discrete or is infinite.
no setterinherited
- last → DateTime
-
The last element.
no setterinherited
- length → int
-
The number of elements in this Iterable.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → DateTime
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
- startInclusive → bool
-
no setterinherited
Methods
-
any(
bool test(DateTime element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
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
-
elementAt(
int index) → DateTime -
Returns the
index
th element.inherited -
end(
{bool? inclusive}) → DateTime? -
If
inclusive
is provided and differs from the current end inclusion, the end value is adjusted to the next or previous value accordingly.inherited -
every(
bool test(DateTime element)) → bool -
Checks whether every element of this iterable satisfies
test
.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
-
expand<
T> (Iterable< T> toElements(DateTime element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(DateTime element), {DateTime orElse()?}) → DateTime -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, DateTime element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< DateTime> other) → Iterable<DateTime> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(DateTime element)) → void -
Invokes
action
on each element of this iterable in iteration order.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
-
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(DateTime element), {DateTime orElse()?}) → DateTime -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T toElement(DateTime e)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
newInstance(
) → DateRange -
Creates a new instance of DateRange.
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
-
reduce(
DateTime combine(DateTime value, DateTime element)) → DateTime -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
singleWhere(
bool test(DateTime element), {DateTime orElse()?}) → DateTime -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< DateTime> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(DateTime value)) → Iterable< DateTime> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
start(
{bool? inclusive}) → DateTime? -
If
inclusive
is provided and differs from the current start inclusion, the start value is adjusted to the next or previous value accordingly.inherited -
take(
int count) → Iterable< DateTime> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(DateTime value)) → Iterable< DateTime> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toList(
{bool growable = true}) → List< DateTime> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< DateTime> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of the date range.
override
-
union(
Range< DateTime> that) → List<Range< DateTime> > -
The union of two ranges is the set of all elements that are in either range.
inherited
-
where(
bool test(DateTime element)) → Iterable< DateTime> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.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 date.
getter/setter pair
- regexValInf ↔ RegExp
-
Regular expression for a range from a date to positive infinity.
getter/setter pair
- regexValVal ↔ RegExp
-
Regular expression for a range between two dates.
getter/setter pair
Static Methods
-
listExcept(
List< DateRange> source, List<DateRange> exceptions) → List<DateRange> -
Returns a list of DateRange objects that represent the difference between the
source
andexceptions
lists. -
parse(
String? input, {bool? startInclusive, bool? endInclusive}) → DateRange? - Parses a string representation of a date range.