DayPeriod class

A class that implements a period type of a day.

Inheritance

Constructors

DayPeriod({required DateTime start, required DateTime end})
A class that implements a period type of a day.

Properties

duration Duration
The difference between the start and end plus one microsecond. If start and end are equal, returns Duration(microseconds: 1).
no setterinherited
end DateTime
The end of the period. It is included in the period.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
hours List<HourPeriod>
Returns the list of hours in this day.
no setter
isEmpty bool
If start and end are equal.
no setterinherited
isNotEmpty bool
If start and end are different.
no setterinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start DateTime
The start of the period. It is included in the period.
finalinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

compareTo(Period other) int
Compares this object to another object.
inherited
containedFullyBy(Period other) bool
Returns true if this is contained fully by other.
inherited
containedPartiallyBy(Period other) bool
Returns true if this is contained partially by other.
inherited
contains(DateTime date) bool
Returns true if this contains the given date. If the date is equal to the start or end or is between the two dates, it will return true.
inherited
containsFully(Period other) bool
Returns true if this fully contains other.
inherited
containsPartially(Period other) bool
Returns true if this contains partially other.
inherited
copyWith({DateTime? start, DateTime? end}) Period
Returns a new Period with the given start and end values. If start or end are not provided, the corresponding value of this is used.
inherited
differenceBetween(Period other) List<Period>
Returns a list of Periods that are the difference between this and other.
inherited
doesNotOverlapWith(Period other) bool
Returns true if this does not overlap with other.
inherited
endsAfter(DateTime date) bool
Returns true if this ends after the given date.
inherited
endsBefore(DateTime date) bool
Returns true if this ends before the given date.
inherited
getDateTimeValues(DateTime? next(DateTime last)) List<DateTime>
Returns a list of DateTime values that are contained in this Period. The next function is used to calculate the DateTime values for the returned list. The next function is called with the last DateTime value, or start. The next function must return a DateTime value that is contained in this Period. The next function must return a DateTime value that is not after the end value of this Period. When the next function returns null, the iteration stops.
inherited
getIntersection(Period other) Period?
Returns a Period that is the intersection of this and other.
inherited
getNext<T extends Period>(PeriodGeneratorMixin<T> generator) → T
Returns a new Period that starts after this using generator.
inherited
getPrevious<T extends Period>(PeriodGeneratorMixin<T> generator) → T
Returns a new Period that starts before this using generator.
inherited
mergeWith(Period other) Period?
Returns a Period that is the union of this and other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
occursAfter(Period other) bool
Returns true if this occurs after other.
inherited
occursBefore(Period other) bool
Returns true if this occurs before other.
inherited
overlapsWith(Period other) bool
Returns true if this overlaps with other.
inherited
shift(Duration duration) Period
Returns a new Period that is shifted by the given duration .
inherited
splitAt(Set<DateTime> dates, {Duration periodBetween = Duration.zero}) List<Period>
Splits the period in multiple periods at the given dates. The periodBetween is the duration between each period. The dates not included in the period are ignored. The dates will be sorted before splitting.
inherited
splitIn(int times, {Duration periodBetween = Duration.zero}) List<Period>
Split the period in multiple periods. The times is the number of periods to split the period in.
inherited
startsAfter(DateTime date) bool
Returns true if this starts after the given date.
inherited
startsBefore(DateTime date) bool
Returns true if this starts before the given date.
inherited
subtract(List<Period> periods) List<Period>
Returns a list of Periods that are the difference between this Period and the periods passed as argument.
inherited
toString({String dateFormat(DateTime date)?}) String
A string representation of this object.
inherited
trim(List<Period> periods) List<Period>
Removes periods that do not overlap with this period and trims the ones that do overlap and are not fully contained by this period.
inherited

Operators

operator &(Period other) Period?
Returns a Period that is the intersection of this and other.
inherited
operator <<(Duration duration) Period
Returns a new Period that is shifted by the given duration backwards.
inherited
operator ==(Object other) bool
The equality operator.
inherited
operator >>(Duration duration) Period
Returns a new Period that is shifted by the given duration forwards.
inherited
operator |(Period other) List<Period>
Returns a list of Periods.
inherited