getWeekNumber method

int getWeekNumber()

Returns the week number of the current week. from 1 to 52.

Implementation

int getWeekNumber() {
  final DateTime lastMonday = subtract(Duration(days: getTodayIndex()));
  return (lastMonday.difference(DateTime(year)).inDays / 7).ceil() + 1;
}