Month class
Represents a month of the year (January to December) with associated properties.
This class provides static instances for each month and helper methods. It uses the standard month numbering (January = 1, ..., December = 12).
- Implemented types
Constructors
- Month(int value)
-
Creates a Month instance from an integer value (1-12).
factory
- Month.fromDateTime(DateTime dateTime)
-
Creates a Month instance from a standard Dart DateTime object.
factory
Properties
- daysCountThisYear → int
-
Returns the number of days in this month for the given
year. Accounts for leap years for February. Returns the number of days in this month for the current year. Accounts for leap years for February. Note: This uses the system's current year at the time of calling.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- name → String
-
The full name of the month (e.g., "January").
final
- next → Month
-
Returns the next month. Wraps around from December to January.
no setter
- previous → Month
-
Returns the previous month. Wraps around from January to December.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shortName → String
-
The common abbreviated name of the month (e.g., "Jan").
final
- value → int
-
The integer value of the month (1 for January, 12 for December).
final
Methods
-
compareTo(
Month other) → int -
Compares this object to another object.
override
-
daysCount(
Year year) → int -
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 ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
daysInMonth(
Year year, Month month) → int
Constants
- april → const Month
- Represents April (value: 4).
- august → const Month
- Represents August (value: 8).
- december → const Month
- Represents December (value: 12).
- february → const Month
- Represents February (value: 2).
- january → const Month
- Represents January (value: 1).
- july → const Month
- Represents July (value: 7).
- june → const Month
- Represents June (value: 6).
- march → const Month
- Represents March (value: 3).
- may → const Month
- Represents May (value: 5).
- november → const Month
- Represents November (value: 11).
- october → const Month
- Represents October (value: 10).
- september → const Month
- Represents September (value: 9).
-
values
→ const List<
Month> - A list of all Month instances in order (January to December).