How To update the PDFView widget in StreamBuilder AndroidStudio?
Admin
- 0
Update PDFView in Easyway.
Also, you don’t need to wrap in PDFView inside a StreamBuilder. Just listen to the stream with the listen method, and call that setPage method in the callback.
DownTips Gives you the correct code.
![](https://downtips.com/wp-content/uploads/2024/01/pdfviewer-1024x801.jpg)
return PDFView(
filePath: widget.pdfPath,
autoSpacing: true,
enableSwipe: true,
pageSnap: true,
swipeHorizontal: true,
defaultPage: currentPage!,
onError: (error) {
print(error);
},
onPageError: (page, error) {
print('$page: ${error.toString()}');
},
onRender: (_pages) {
setState(() {
pages = _pages!;
isReady = true;
print ('currpage: $currentPage');
});
},
onViewCreated: (PDFViewController vc) {
setState(() {
_pdfController = vc;
_controller.complete(vc);
vc.setPage(currentPage);
print(page);
print(snapshot.data?['page']);
});
},
onPageChanged: (int? page, int? total) {
setState(() {
currentPage = page!;
});
});`