previousPage method Null safety

void previousPage()

Navigates to the previous page of a PDF document.

Using this method, the SfPdfViewer navigates to the previous page of a PDF document. If the previous page doesn't exists, then the navigation will not happen and the older page will be retained.

Returns null.

This example demonstrates how to navigate to the next and previous page.

class MyAppState extends State<MyApp>{
 late PdfViewerController _pdfViewerController;

 @override
 void initState(){
   _pdfViewerController = PdfViewerController();
   super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       appBar: AppBar(
          title: Text('Syncfusion Flutter PdfViewer'),
          actions: <Widget>[
             IconButton(
                icon: Icon(
                   Icons.keyboard_arrow_up,
                   color: Colors.white,
                ),
                onPressed: () {
                   _pdfViewerController.previousPage();
                },
             ),
          ],
       ),
       body: SfPdfViewer.asset(
         'assets/flutter-succinctly.pdf',
         controller: _pdfViewerController,
       ),
     ),
   );
 }
}

Implementation

void previousPage() {
  _pageNavigator = Pagination(Navigation.previousPage);
  notifyPropertyChangedListeners(property: 'pageNavigate');
}