int daysInMonth(DateTime date) => DateTimeRange( start: DateTime(date.year, date.month,1), end: DateTime(date.year, date.month + 1)) .duration .inDays; print("Days in current month is ${daysInMonth(DateTime.now())}");