print method

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

Consumes the given amount of pages with the print right.

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

Implementation

@override
bool print(int pageCount) {
  int? pagesLeft = pagesToPrintLeft;
  if (pagesLeft == null) {
    return true;
  }
  if (pagesLeft < pageCount) {
    return false;
  }
  try {
    pagesLeft = max(0, pagesLeft - pageCount);
    _licenses.setPrintsLeft(pagesLeft, license.id);
  } on Error catch (error) {
    Fimber.e("ERROR in print", ex: error);
  }
  return true;
}