PageRange class
Represents a page range for printing.
This class provides a type-safe way to define which pages of a document to print. It can represent a single page, a continuous range of pages, or a complex combination of pages and ranges.
Example usage:
// Print only page 5
final singlePage = PageRange.single(5);
// Print pages 2 through 7
final continuousRange = PageRange.range(2, 7);
// Print pages 1, 3-5, and 8
final complexRange = PageRange.multiple([
PageRange.single(1),
PageRange.range(3, 5),
PageRange.single(8),
]);
// Parse from a string
final fromString = PageRange.parse("1-3,5,7-9");
Constructors
-
PageRange.multiple(List<
PageRange> ranges) -
Creates a complex page range by combining multiple PageRange objects.
factory
- PageRange.parse(String rangeString)
-
Parses a page range string (e.g., "1-3,5,7-9") into a PageRange object.
factory
- PageRange.range(int start, int end)
-
Creates a page range from a
start
to anend
page, inclusive.factory - PageRange.single(int page)
-
Creates a page range representing a single page.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
toValue(
) → String - Returns the underlying string value of the page range.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited