undo method

void undo(
  1. PdfViewerController pdfViewerController
)

Undoes the last highlight/underline action on the current page.

Implementation

void undo(PdfViewerController pdfViewerController) {
  if (_highlightHistory[_currentPage]?.isNotEmpty == true) {
    var lastAction = _highlightHistory[_currentPage]!.removeLast();
    _highlightUndoStack[_currentPage]!.add(lastAction);
    pdfViewerController.removeAnnotation(lastAction.annotation);
    notifyListeners();
  }
}