PageRange.range constructor
Creates a page range from a start
to an end
page, inclusive.
Throws an ArgumentError if pages are not positive or if end
is less than start
.
Implementation
factory PageRange.range(int start, int end) {
if (start <= 0) {
throw ArgumentError('Start page must be positive, but was $start.');
}
if (end < start) {
throw ArgumentError('End page ($end) cannot be less than start page ($start).');
}
return PageRange._('$start-$end');
}