getDaysInMonth static method
ref Flutter DateUtils.getDaysInMonth
Implementation
static int getDaysInMonth(int year, int month) {
if (month == DateTime.february) {
final isLeapYear =
(year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
return isLeapYear ? 29 : 28;
}
const daysInMonth = <int>[31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
return daysInMonth[month - 1];
}