Down Tips

Way To Learn

Android Tips

How To update the PDFView widget in StreamBuilder AndroidStudio?

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.

return PDFView(
                  filePath: widget.pdfPath,
                  autoSpacing: true,
                  enableSwipe: true,
                  pageSnap: true,
                  swipeHorizontal: true,
                  defaultPage: currentPage!,
                  onError: (error) {
                  onPageError: (page, error) {
                    print('$page: ${error.toString()}');
                  onRender: (_pages) {
                    setState(() {
                      pages = _pages!;
                      isReady = true;
                      print ('currpage:  $currentPage');
                  onViewCreated: (PDFViewController vc)  {
                    setState(() {
                      _pdfController = vc;

                  onPageChanged: (int? page, int? total) {
                    setState(() {
                      currentPage = page!;