Error when I try to use SfPdfViewer Pacakge

When I add this piece of code:

return Scaffold(
      appBar: AppBar(
        title: Text('Welcome, ${userName}'),
      ),
      body: SfPdfViewer.asset('assets/Form.pdf')
    );


I get the following error:

/C:/Users/ziadg/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-25.2.5/lib/src/form_fields/pdf_signature.dart:579:25: Error: Couldn't find constructor 'WidgetStatePropertyAll'.

                ? const WidgetStatePropertyAll<Color>(Colors.transparent)

                        ^^^^^^^^^^^^^^^^^^^^^^

/C:/Users/ziadg/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-25.2.5/lib/src/control/pdfviewer_canvas.dart:604:36: Error: The getter 'WidgetStateProperty' isn't defined for the class 'CanvasRenderBox'.

 - 'CanvasRenderBox' is from 'package:syncfusion_flutter_pdfviewer/src/control/pdfviewer_canvas.dart' ('/C:/Users/ziadg/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-25.2.5/lib/src/control/pdfviewer_canvas.dart').

Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.

                          padding: WidgetStateProperty.all(

                                   ^^^^^^^^^^^^^^^^^^^

/C:/Users/ziadg/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-25.2.5/lib/src/control/pdfviewer_canvas.dart:637:38: Error: The getter 'WidgetStateProperty' isn't defined for the class 'CanvasRenderBox'.

 - 'CanvasRenderBox' is from 'package:syncfusion_flutter_pdfviewer/src/control/pdfviewer_canvas.dart' ('/C:/Users/ziadg/AppData/Local/Pub/Cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-25.2.5/lib/src/control/pdfviewer_canvas.dart').

Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.

                            padding: WidgetStateProperty.all(

                                     ^^^^^^^^^^^^^^^^^^^


1 Reply

IP ImmanKumarP Palanikumar Syncfusion Team May 22, 2024 05:03 AM UTC

Hi Ziad Ghanem,

We have migrated our source to be compatible with Flutter SDK 3.22.0. In Flutter SDK version 3.22.0, MaterialState and its related APIs have been moved out of the Material library and renamed to WidgetState.

So, we kindly request that you upgrade the Flutter SDK version to 3.22.0, or else use the package syncfusion_flutter_pdfviewer version below 25.2.4.

We have also shared the breaking changes documentation below for your reference.
Rename MaterialState to WidgetState | Flutter

We hope it will help you resolve the issue. If you have any further queries, please get back to us.

Regards,

Imman Kumar P


Loader.
Up arrow icon