daysCountFromNumber static method
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.
Implementation
static int daysCountFromNumber(int month, {int? year}) {
return DaysInMonth.values[month - 1].getDays(year: year);
}