canPrintPageCount method

  1. @override
bool canPrintPageCount(
  1. int pageCount
)

Returns whether the user is allowed to print the given amount of pages.

This is more specific than the canPrint property, and can return false if the given pageCount exceeds the allowed amount of pages to print.

To be used before attempting to launch a print job, for example.

Implementation

@override
bool canPrintPageCount(int pageCount) {
  int? pagesLeft = pagesToPrintLeft;
  return (pagesLeft != null) ? pagesLeft < pageCount : true;
}