totalDaysOfMonth static method
Get total day of month
final totalDay = totalDaysOfMonth(year:2021, month:11);
print(totalDay) // 30
Implementation
static int totalDaysOfMonth({
required int year,
required int month,
}) {
final result =
(month < 12) ? DateTime(year, month + 1, 0) : DateTime(year + 1, 1, 0);
return result.day;
}