YearPeriod class
A class that implements a period type of a year.
- Inheritance
- Implemented types
Constructors
- YearPeriod({required DateTime start, required DateTime end})
- A class that implements a period type of a year.
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
- isEmpty → bool
-
If start and end are equal.
no setterinherited
- isNotEmpty → bool
-
If start and end are different.
no setterinherited
-
months
→ List<
MonthPeriod> -
Returns the list of months in this bundle.
no setteroverride
-
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 byother
.inherited -
containedPartiallyBy(
Period other) → bool -
Returns
true
if this is contained partially byother
.inherited -
contains(
DateTime date) → bool -
Returns
true
if this contains the givendate
. If thedate
is equal to the start or end or is between the two dates, it will returntrue
.inherited -
containsFully(
Period other) → bool -
Returns
true
if this fully containsother
.inherited -
containsPartially(
Period other) → bool -
Returns
true
if this contains partiallyother
.inherited -
copyWith(
{DateTime? start, DateTime? end}) → Period -
Returns a new Period with the given
start
andend
values. Ifstart
orend
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 withother
.inherited -
endsAfter(
DateTime date) → bool -
Returns
true
if this ends after the givendate
.inherited -
endsBefore(
DateTime date) → bool -
Returns
true
if this ends before the givendate
.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. Thenext
function is called with the last DateTime value, or start. Thenext
function must return a DateTime value that is contained in this Period. Thenext
function must return a DateTime value that is not after the end value of this Period. When thenext
function returnsnull
, 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 afterother
.inherited -
occursBefore(
Period other) → bool -
Returns
true
if this occurs beforeother
.inherited -
overlapsWith(
Period other) → bool -
Returns
true
if this overlaps withother
.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
. TheperiodBetween
is the duration between each period. Thedates
not included in the period are ignored. Thedates
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 givendate
.inherited -
startsBefore(
DateTime date) → bool -
Returns
true
if this starts before the givendate
.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