Year class final

A year in the ISO 8601 calendar.

The number corresponds to these years, according to ISO 8601:

Value Meaning
2023 2023 CE/AD
1 1 CE/AD
0 1 BCE/BC
-1 2 BCE/BC

There is no limitation on the range of years.

Implemented types
Annotations
  • @immutable

Constructors

Year(int number)
const
Year.currentInLocalZone({Clock? clock})
factory
Year.currentInUtc({Clock? clock})
factory

Properties

days Iterable<Date>
An iterable of all days in this year.
no setter
firstDay Date
The first day of this year.
no setter
firstMonth YearMonth
The first month of this year.
no setter
firstOrdinalDate OrdinalDate
The first day of this year as an OrdinalDate.
no setter
firstWeek YearWeek
The first week of this year.
no setter
hashCode int
The hash code for this object.
no setteroverride
isCommonYear bool
Whether this year is a common (non-leap) year.
no setter
isLeapYear bool
Whether this year is a leap year.
no setter
lastDay Date
The last day of this year.
no setter
lastMonth YearMonth
The last month of this year.
no setter
lastOrdinalDate OrdinalDate
The last day of this year as an OrdinalDate.
no setter
lastWeek YearWeek
The last week of this year.
no setter
length Days
no setter
months Iterable<YearMonth>
An iterable of all months in this year.
no setter
next Year
The year after this one.
no setter
number int
final
numberOfWeeks int
no setter
previous Year
The year before this one.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
weeks Iterable<YearWeek>
An iterable of all weeks in this year.
no setter

Methods

compareTo(Year other) int
Compares this object to another object.
override
isCurrentInLocalZone({Clock? clock}) bool
isCurrentInUtc({Clock? clock}) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator +(Years duration) Year
operator -(Years duration) Year
operator <(Year other) bool
inherited
operator <=(Year other) bool
inherited
operator ==(Object other) bool
The equality operator.
override
operator >(Year other) bool
inherited
operator >=(Year other) bool
inherited

Constants

unixEpoch → const Year
The UNIX epoch: 1970.