getDaysInMonth function
Gets the number of days for the given month, by taking the next month on day 0 and getting the number of days.
Implementation
int getDaysInMonth(int year, int month) {
return month < DateTime.monthsPerYear
? DateTime(year, month + 1, 0).day
: DateTime(year + 1, 1, 0).day;
}