static int getWeekDay(DateTime _date, bool startWeekWithSunday) { if (startWeekWithSunday) { return _date.weekday == DateTime.sunday ? 1 : _date.weekday + 1; } else { return _date.weekday; } }