'How to get the first, second, third, and fourth week of the month?

I want to get all four weeks (first and last day date) on the current month with Monday as the start of the week.

I can only figure out how to get the current week's first and last date with this code:

var firstDayOfTheWeek =  DateTime.now().subtract(Duration(days: DateTime.now().weekday - 1));
var lastDayOfTheWeek =  DateTime.now().add(Duration(days: DateTime.daysPerWeek - DateTime.now().weekday));

Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source