getDatesByDay method
Implementation
List<DateTime> getDatesByDay(int year, int month, String day) {
Year y = years!.firstWhere((element) => element.value == year);
Month m = y.months.firstWhere((element) => element.value == month);
int count = 0;
List<Day> d = m.days.where((element) {
if (data['BYSETPOS'] != null && element.name.toLowerCase() == day.toLowerCase()) {
count++;
String daysPositions = data['BYSETPOS'] ?? '';
List<String> positions = daysPositions.split(',');
if (positions.contains(count.toString())) {
return true;
}
} else {
return element.name.toLowerCase() == day.toLowerCase();
}
return false;
}).toList();
return d.map((e) => DateTime(year, month, e.value)).toList();
}