firstPage method Null safety

void firstPage()

Navigates to the first page of a PDF document.

Using this method, the SfPdfViewer navigates to the first page of a PDF document. If the current page displayed is already the first 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.first_page,
                   color: Colors.white,
                ),
                onPressed: () {
                   _pdfViewerController.firstPage();
                },
             ),
          ],
       ),
       body: SfPdfViewer.asset(
         'assets/flutter-succinctly.pdf',
         controller: _pdfViewerController,
       ),
     ),
   );
 }
}

Implementation

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