Conversation
resetTextSearch was the only way to end a search, and it also cleared the matches. stopTextSearch cancels the running (or pending) search, keeps matches and the current match, and notifies listeners. Re-issuing the same pattern then searches the whole document again.
… off screen An app that keeps several viewers alive (e.g. tabs in a keep-alive PageView) holds every viewer's page images until the viewer is disposed. releaseCachedImages disposes them and cancels their pending renders; released pages are rendered again the next time they are painted. By default the images of the pages on screen are kept, so showing the viewer again does not flash blank pages.
palmoni5
added a commit
to palmoni5/otzaria
that referenced
this pull request
Sep 27, 2026
הענף perf/viewer-render-order מכיל עכשיו גם את stopTextSearch ואת releaseCachedImages. חוזרים ל-pub.dev רק אחרי ש-Otzaria#724, Otzaria#729 ו-Otzaria#730 ימוזגו וישוחררו.
Y-PLONI
pushed a commit
to palmoni5/otzaria
that referenced
this pull request
Sep 28, 2026
הענף perf/viewer-render-order מכיל עכשיו גם את stopTextSearch ואת releaseCachedImages. חוזרים ל-pub.dev רק אחרי ש-Otzaria#724, Otzaria#729 ו-Otzaria#730 ימוזגו וישוחררו.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small additive APIs. Each is its own commit.
1.
PdfTextSearcher.stopTextSearch()resetTextSearch()is the only way to end a search today, and it also clears the matches. A search pane that offers a "stop" button during a long scan has to throw away what was found.stopTextSearch():matchesand the current match;isSearchingtofalseand notifies listeners.It also clears the stored condition, so starting the same pattern again searches the whole document.
2.
PdfViewerController.releaseCachedImages({bool keepVisible = true})An app that keeps several viewers alive (tabs in a keep-alive
PageView, split panes) holds every viewer's page images until each viewer is disposed.limitRenderingCache/maxImageBytesCachedOnMemorybound one viewer, but not the sum over hidden ones.releaseCachedImages():Released pages are rendered again the next time they are painted. With
keepVisible(the default), the images of the pages overlapping the visible rect are kept, so showing the viewer again does not flash blank pages.Testing
test/pdf_text_searcher_test.dart(new): stopping mid-scan keeps the matches of the pages already searched, notifies once, and a re-issued pattern searches all pages again.releaseCachedImageshas no dedicated test. The image cache is private, and the effect is native memory. It is exercised in Otzaria, which calls it when a PDF tab leaves the screen.packages/pdfrx:PDFIUM_PATH=... flutter test: all tests passed.flutter analyze lib test: clean apart from the pre-existing info intest/lazy_loading_test.dart.Independent of #729; the two touch nearby lines in
pdf_viewer.dartandpdf_text_searcher.dart, so whichever lands second may need a trivial rebase.