Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DartError: TypeError: "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/": type 'String' is not a subtype of type 'Never' #1761

Open
MacDeveloper1 opened this issue Oct 9, 2024 · 2 comments
Labels
bug Something isn't working needs triage

Comments

@MacDeveloper1
Copy link
Contributor

MacDeveloper1 commented Oct 9, 2024

In my project I used overriding feature for loading pdf.js from another cloud storage.

  <script>
    // PDF.js options
    var dartPdfJsBaseUrl = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/";
  </script>

So the result URL should be https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/pdf.min.js.

Now I get this error:

DartError: TypeError: "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/": type 'String' is not a subtype of type 'Never'
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3  throw_
errors.dart:296
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1405:3                         _failedAsCheck
rti.dart:1405
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1383:3                         _generalAsCheckImplementation
rti.dart:1383
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1278:30                        _installSpecializedAsCheck
rti.dart:1278
dart-sdk/lib/_internal/js_shared/lib/js_interop_unsafe_patch.dart 20:7       JSObjectUnsafeUtilExtension.getProperty
js_interop_unsafe_patch.dart:20
packages/printing/printing_web.dart 98:36                                    _initPlugin
printing_web.dart:98
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50           <fn>
async_patch.dart:45
dart-sdk/lib/async/zone.dart 1661:54                                         runUnary
zone.dart:1661
dart-sdk/lib/async/future_impl.dart 163:18                                   handleValue
future_impl.dart:163
dart-sdk/lib/async/future_impl.dart 861:44                                   handleValueCallback
future_impl.dart:861
dart-sdk/lib/async/future_impl.dart 890:13                                   _propagateToListeners
future_impl.dart:890
dart-sdk/lib/async/future_impl.dart 666:5                                    [_completeWithValue]
future_impl.dart:666
dart-sdk/lib/async/future_impl.dart 736:7                                    callback
future_impl.dart:736
dart-sdk/lib/async/schedule_microtask.dart 40:11                             _microtaskLoop
schedule_microtask.dart:40
dart-sdk/lib/async/schedule_microtask.dart 49:5                              _startMicrotaskLoop
schedule_microtask.dart:49
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7           <fn>
flutter -v doctor

[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4317], locale en-NL)
• Flutter version 3.24.3 on channel stable at C:\data\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\at\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2023.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)

[√] VS Code (version 1.94.1)
• VS Code at C:\Users\at\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.98.0

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4317]
• Chrome (web) • chrome • web-javascript • Google Chrome 129.0.6668.90
• Edge (web) • edge • web-javascript • Microsoft Edge 123.0.2420.65

[√] Network resources
• All expected network resources are available.

! Doctor found issues in 1 category.

@MacDeveloper1 MacDeveloper1 added bug Something isn't working needs triage labels Oct 9, 2024
@abdulrehmananwar
Copy link

facing same error on web when i click on printer button .
TypeError: null: type 'Null' is not a subtype of type 'JSObject'

my html code is

<script> var dartPdfJsBaseUrl = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/"; </script> <title>pdfpreview</title> <script src="flutter_bootstrap.js" async></script>

Repository owner deleted a comment Oct 24, 2024
@luccaslyra
Copy link

Me too! Mine is a flutter web app testing on chrome. Before flutter 3.24.3 it was working fina, but now i got this erro:
errors.dart:296 Uncaught (in promise) DartError: TypeError: null: type 'Null' is not a subtype of type 'JSObject'
at Object.throw_ [as throw] (errors.dart:296:3)
at Object._failedAsCheck (rti.dart:1405:3)
at dart_rti.Rti.new._generalAsCheckImplementation (rti.dart:1383:3)
at Object.getProperty (js_util_patch.dart:81:5)
at printing_web.PrintingPlugin.new.layoutPdf (printing_web.dart:196:32)
at layoutPdf.next ()
at async_patch.dart:45:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

3 participants