lastPage method Null safety

void lastPage()

Navigates to the last page of a PDF document.

Using this method, the SfPdfViewer navigates to the last page of a PDF document. If the current page displayed is already the last page, then nothing happens.

Returns null.

This example demonstrates how to navigate to the first and last 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.last_page,
                   color: Colors.white,
                ),
                onPressed: () {
                   _pdfViewerController.lastPage();
                },
             ),
          ],
       ),
       body: SfPdfViewer.asset(
         'assets/flutter-succinctly.pdf',
         controller: _pdfViewerController,
       ),
     ),
   );
 }
}

Implementation

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