lastDayOfMonth property

DateTime get lastDayOfMonth

Returns DateTime object of Last Day of the Month.

final checkDate =
     DateTime.parse('2023-09-16 20:18:00.123456789z');
checkDate.nextMonth;         // 31-10-2023

This will not consider time Parameters.

Implementation

DateTime get lastDayOfMonth => nextMonth.superSubtract(days: 1);