daysInMonth property

int get daysInMonth

returns the number of days in the month of this DateTime

Implementation

int get daysInMonth => DateTime(year, month + 1, 0).day;