getDaysOfWeek method
Implementation
List<String> getDaysOfWeek([String locale = 'pt']) {
var today = DateTime.now();
while (today.weekday != weekdayStart) {
today = today.subtract(const Duration(days: 1));
}
final dateFormat = DateFormat(DateFormat.ABBR_WEEKDAY, locale);
final daysOfWeek = [
dateFormat.format(today),
dateFormat.format(today.add(const Duration(days: 1))),
dateFormat.format(today.add(const Duration(days: 2))),
dateFormat.format(today.add(const Duration(days: 3))),
dateFormat.format(today.add(const Duration(days: 4))),
dateFormat.format(today.add(const Duration(days: 5))),
dateFormat.format(today.add(const Duration(days: 6)))
];
return daysOfWeek;
}