dart-lang/webdev

TypeError: null: type 'JSNull' is not a subtype of type 'String'

Closed this issue · 0 comments

I wanted to enable autofill in my login widget.

AutofillGroup(
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        TextFormField(
         autofillHints: const [AutofillHints.email], 
        ),
        TextFormField(
          autofillHints: const [AutofillHints.password],
        ),]))

Here are the steps to repro:

  1. Click into email/password field

  2. pass autofill reqs

Image
3. Exception is thrown

Unhandled error detected in the injected client.js script.

You can disable this script in webdev by passing --no-injected-client if it
is preventing your app from loading, but note that this will also prevent
all debugging and hot reload/restart functionality from working.

The original error is below, please file an issue at
https://github.com/dart-lang/webdev/issues/new and attach this output:

TypeError: null: type 'JSNull' is not a subtype of type 'String'

at Object.wrapException (http://localhost:63873/dwds/src/injected/client.js:1249:43)
at Object._asString (http://localhost:63873/dwds/src/injected/client.js:2840:15)
at main__closure7.call$1 (http://localhost:63873/dwds/src/injected/client.js:26677:54)
at _EventStreamSubscription_closure.call$1 (http://localhost:63873/dwds/src/injected/client.js:26040:26)
at StaticClosure._rootRunUnary (http://localhost:63873/dwds/src/injected/client.js:4382:16)
at _CustomZone.runUnary$2$2 (http://localhost:63873/dwds/src/injected/client.js:14273:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:63873/dwds/src/injected/client.js:14220:14)
at _CustomZone_bindUnaryCallbackGuarded_closure.call$1 (http://localhost:63873/dwds/src/injected/client.js:14407:25)
at _callDartFunctionFast1 (http://localhost:63873/dwds/src/injected/client.js:7680:25)
at http://localhost:63873/dwds/src/injected/client.js:7656:18

flutter doctor -v
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.4 24E248 darwin-arm64, locale en-US) [385ms]
• Flutter version 3.29.2 on channel stable at /
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c236373904 (6 weeks ago), 2025-03-13 16:17:06 -0400
• Engine revision 18b71d647a
• Dart version 3.7.2
• DevTools version 2.42.3

[✗] Android toolchain - develop for Android devices [53ms]
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/macos-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.

[✗] Xcode - develop for iOS and macOS [85ms]
✗ Xcode installation is incomplete; a full installation is necessary for iOS and macOS development.
Download at: https://developer.apple.com/xcode/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation

[✓] Chrome - develop for the web [22ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [21ms]
• Android Studio at /Applications/Android Studio.app/Contents
• 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 21.0.5+-12932927-b750.29)

[✓] VS Code (version 1.99.3) [20ms]
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.108.0

[✓] Connected device (2 available) [130ms]
• macOS (desktop) • macos • darwin-arm64
• Chrome (web) • chrome • web-javascript

[✓] Network resources [232ms]
• All expected network resources are available.

! Doctor found issues in 2 categories.

Now what's interesting, is that when I attempt to redo steps 1-2. It works.