DaysInMonth enum
An enum that stores how many does a month normally has The enums are named by the name of the months, i.e. all 12 of them
They have two values
Values
- january → const DaysInMonth
-
const DaysInMonth(1, 31) - february → const DaysInMonth
-
const DaysInMonth(2, 28) - march → const DaysInMonth
-
const DaysInMonth(3, 31) - april → const DaysInMonth
-
const DaysInMonth(4, 30) - may → const DaysInMonth
-
const DaysInMonth(5, 31) - june → const DaysInMonth
-
const DaysInMonth(6, 30) - july → const DaysInMonth
-
const DaysInMonth(7, 31) - august → const DaysInMonth
-
const DaysInMonth(8, 31) - september → const DaysInMonth
-
const DaysInMonth(9, 30) - october → const DaysInMonth
-
const DaysInMonth(10, 31) - november → const DaysInMonth
-
const DaysInMonth(11, 30) - december → const DaysInMonth
-
const DaysInMonth(12, 31)
Properties
- days → int
-
Getter for the number of days present in the month
Does not check for leap year hence for february the number
of days will always be 28.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- month → int
-
The number of the month. Starts with 1, i.e. january
final
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getDays(
{int? year}) → int - Returns the number of days in the month It takes the year as an optional parameter
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
daysCountFromNumber(
int month, {int? year}) → int - Returns the number of days in the month from its number It takes the year as an optional parameter to check for leap years in getDays method.
Constants
-
values
→ const List<
DaysInMonth> - A constant List of the values in this enum, in order of their declaration.