pages property
Implementation
Iterable<int> get pages sync* {
if (totalPages <= maxPages) {
yield* List.generate(totalPages, (index) => index + 1);
} else {
final start = page - maxPages ~/ 2;
final end = page + maxPages ~/ 2;
if (start < 1) {
yield* List.generate(maxPages, (index) => index + 1);
} else if (end > totalPages) {
yield* List.generate(
maxPages, (index) => totalPages - maxPages + index + 1);
} else {
yield* List.generate(maxPages, (index) => start + index);
}
}
}