syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.46k stars 680 forks source link

pdf is not working ,please check it #1069

Closed engineer-ece closed 1 year ago

engineer-ece commented 1 year ago

/D:/src/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdf-20.4.48/lib/src/pdf/implementation/forms/pdf_xfdf_document.dart:38:35: Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.

rahulserver commented 1 year ago

I am facing the same exact issue with version 20.4.48 (latest currently). Is this plugin version working for anyone?

GSORF commented 1 year ago

I can confirm this issue with the latest version.

I tried switching between iOS and Android and clearing my pub cache via: dart pub cache clean

Nothing helped. The error log is quite long, maybe it helps when I post the full error:

../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.48/lib/src/widgets/interactive_scroll_viewer.dart:59:9: Error: Type 'PanAxis' not found.
  final PanAxis panAxis;
        ^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.48/lib/src/widgets/interactive_scroll_viewer.dart:15:22: Error: Undefined name 'PanAxis'.
      this.panAxis = PanAxis.free,
                     ^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.48/lib/src/pdfviewer.dart:1016:54: Error: Method 'readState' cannot be called on 'PageStorageBucket?' because it is potentially null.
 - 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../../../Development/flutter/packages/flutter/lib/src/widgets/page_storage.dart').
Try calling using ?. instead.
      final dynamic offset = PageStorage.of(context).readState(context);
                                                     ^^^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.48/lib/src/pdfviewer.dart:1020:12: Error: Method 'readState' cannot be called on 'PageStorageBucket?' because it is potentially null.
 - 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../../../Development/flutter/packages/flutter/lib/src/widgets/page_storage.dart').
Try calling using ?. instead.
          .readState(context, identifier: 'zoomLevel_${widget.key}');
           ^^^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.48/lib/src/pdfviewer.dart:3244:35: Error: Method 'writeState' cannot be called on 'PageStorageBucket?' because it is potentially null.
 - 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../../../Development/flutter/packages/flutter/lib/src/widgets/page_storage.dart').
Try calling using ?. instead.
          PageStorage.of(context).writeState(
                                  ^^^^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.48/lib/src/pdfviewer.dart:3272:35: Error: Method 'writeState' cannot be called on 'PageStorageBucket?' because it is potentially null.
 - 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../../../Development/flutter/packages/flutter/lib/src/widgets/page_storage.dart').
Try calling using ?. instead.
          PageStorage.of(context).writeState(
                                  ^^^^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.48/lib/src/widgets/interactive_scroll_viewer.dart:59:9: Error: 'PanAxis' isn't a type.
  final PanAxis panAxis;
        ^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.48/lib/src/widgets/interactive_scroll_viewer.dart:299:9: Error: No named parameter with the name 'panAxis'.
        panAxis: widget.panAxis,
        ^^^^^^^
../../../Development/flutter/packages/flutter/lib/src/widgets/interactive_viewer.dart:61:3: Context: Found this candidate, but the arguments don't match.
  InteractiveViewer({
  ^^^^^^^^^^^^^^^^^
../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdf-20.4.48/lib/src/pdf/implementation/forms/pdf_xfdf_document.dart:38:35: Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.
 - 'Object' is from 'dart:core'.
        builder.attribute('href', _pdfFilePath);
                                  ^

FAILURE: Build failed with an exception.

* Where:
Script '/Users/USER/Development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/USER/Development/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

I am on a M1 MacBook Pro 2020 with MacOS Ventura 13.0.1.

A fix would be highly appreciated!

Kind regards, Adam

GSORF commented 1 year ago

FYI: Duplicate of #1067 and #1064 .

Solution proposed in #1064 is to upgrade the flutter SDK by running flutter upgrade

This worked for me and I am able to now compile my iOS app with the syncfusion SfPDFViewer widget! But before this, I broke my flutter installation and it took me an hour to google for the fixes, so beware of that!

I do not remember all of the commands, but among these are the following:

It was quite chaotic and in retrospective I think it would have been easier to just re-install flutter. However, I did not test that.

I hope that this will help you resolving your issues regarding the most recent release of the SF flutter widget.

Kind regards, Adam

rahulserver commented 1 year ago

Upgrading flutter is way too much hassle. I don't want to break existing dependencies and open another can of worms. Would either go for a different library or use a version of this one which is compatiable with my flutter version ( [✓] Flutter (Channel beta, 3.7.0-1.3.pre, on macOS 12.5 21G72 darwin-x64, locale en-GB) )

Currently trying to find which version will work for my flutter.

engineer-ece commented 1 year ago

syncfusion_flutter_core: 20.3.59 syncfusion_flutter_pdf: 20.3.59 syncfusion_flutter_pdfviewer: 20.3.59

This is working, thank you sir, i checked. In new version only throwing bug in above

irfanajaffer commented 1 year ago

We found that the problem is due to the older version of the xml package being referred to in your project. Recently, the XmlBuilder attribute value API has been updated from non-nullable to nullable type; you can refer to the following API reference for further details.


Xml package version 6.2.0 | Xml package version 6.2.2 -- | -- https://pub.dev/documentation/xml/6.2.0/xml/XmlBuilder/attribute.html | https://pub.dev/documentation/xml/latest/xml/XmlBuilder/attribute.html


So, we request you to update your pub cache by using the following command to resolve the issue.

dart pub cache add xml --version "6.2.2"


You can refer https://dart.dev/tools/pub/cmd/pub-cache for more details.


fuzailkhannn commented 1 year ago

@abehbatre This worked for me. Thanks, a lot.

temporary fix: downgrade to:

  # syncfusion
  syncfusion_flutter_core: 20.3.59
  syncfusion_flutter_pdf: 20.3.59
  syncfusion_flutter_pdfviewer: 20.3.59
scuti-dai commented 1 year ago

+1

ChieuDev commented 1 year ago

it don't working for me.

temporary fix: downgrade to:

  # syncfusion
  syncfusion_flutter_core: 20.3.59
  syncfusion_flutter_pdf: 20.3.59
  syncfusion_flutter_pdfviewer: 20.3.59
myselfuser1 commented 1 year ago

This will help https://www.youtube.com/watch?v=gAUVz0U7eyA

chinnumuniyappan commented 1 year ago

The reported problem has been resolved in the latest versions.