skip to Main Content

When using Flutter version 3.10.0, I am getting the following error when using PdfPreview() from the printing package:

TypeError: Cannot set properties of null (setting 'exports') https://unpkg.com/[email protected]/build/pdf.min.js 22:113 webpackUniversalModuleDefinition https://unpkg.com/[email protected]/build/pdf.min.js 22:294 <fn> Error: NoSuchMethodError: '[]' Dynamic call of null. Receiver: null Arguments: ["GlobalWorkerOptions"] dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:49 throw_ dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 813:3 defaultNoSuchMethod dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 807:56 noSuchMethod dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 283:12 callNSM dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 294:25 _checkAndCall dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 431:10 callMethod dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 435:5 dsend packages/printing/printing_web.dart 90:29 _initPlugin dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50 <fn> dart-sdk/lib/async/zone.dart 1661:54 runUnary dart-sdk/lib/async/future_impl.dart 147:18 handleValue dart-sdk/lib/async/future_impl.dart 784:44 handleValueCallback dart-sdk/lib/async/future_impl.dart 813:13 _propagateToListeners dart-sdk/lib/async/future_impl.dart 575:7 [_complete] dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue dart-sdk/lib/async/stream.dart 1581:7 <fn> dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37 _checkAndCall dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39 dcall dart-sdk/lib/html/dart2js/html_dart2js.dart 37263:58 <fn>

I downgraded to Flutter version 3.7.12, compiled again, and it worked fine. Repeated the process and kept getting same result (working with 3.7.12, not working with 3.10.0). Does someone know if a dependency has to be added or changed? As I understand it might be an error when compiling to JavaScript on the exports section.

2

Answers


  1. I don’t have an answer yet, but I am experiencing the exact same problem. Everything functions well on Android, iOS, and MacOS; then fails when I run it for the web…

    If I find a solution I will post it here.

    Login or Signup to reply.
  2. Paste the below lines of code in pubspec.yml

    dependency_overrides:
    pdf:
    git:
    url: https://github.com/DavBfr/dart_pdf
    ref: master
    path: pdf
    printing:
    git:
    url: https://github.com/DavBfr/dart_pdf
    ref: master
    path: printing

    [![enter image description here][1]][1]
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search