Skip to content

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

Description

@MacDeveloper1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions