weeksInYear property
int
weeksInYear
The number of weeks in this year (52
or 53
).
Implementation
int get weeksInYear {
int offset(int y) => (y + y ~/ 4 - y ~/ 100 + y ~/ 400) % 7;
return offset(year) == 4 || offset(year - 1) == 3 ? 53 : 52;
}