skip to Main Content

I do not know when it stopped working on web. I know it used to. However, now anytime I try to run a debug version of my app on web, it throws a TypeError error.

Logs:

Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
This app is linked to the debug service: ws://127.0.0.1:54101/Qknz_K4xs_g=/ws
Debug service listening on ws://127.0.0.1:54101/Qknz_K4xs_g=/ws
Debug service listening on ws://127.0.0.1:54101/Qknz_K4xs_g=/ws
Error: TypeError: Instance of 'ArgumentError': type 'ArgumentError' is not a subtype of type 'JavaScriptObject'
dart:sdk_internal 11932:11                                                    throw_
dart:sdk_internal 24589:15                                                    _failedAsCheck
dart:sdk_internal 24575:14                                                    _generalAsCheckImplementation
app/packages/_flutterfire_internals/_flutterfire_internals.dart.lib.js 70:38  _testException
dart:sdk_internal 49595:59                                                    runUnary
dart:sdk_internal 44726:29                                                    matchesErrorTest
dart:sdk_internal 45337:30                                                    handleError
dart:sdk_internal 45364:17                                                    _propagateToListeners
dart:sdk_internal 45207:23                                                    [_completeError]
dart:sdk_internal 45250:31                                                    callback
dart:sdk_internal 50044:13                                                    _microtaskLoop
dart:sdk_internal 50050:13                                                    _startMicrotaskLoop
dart:sdk_internal 45591:9                                                     <fn>
Application finished.

Flutter doctor -v:

[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-US)
    • Flutter version 3.19.6 on channel stable at /Users/canyon/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (2 days ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/canyon/Library/Android/sdk
    • Platform android-34, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.14.3

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

[✓] Android Studio (version 2023.2)
    • 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 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.86.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.82.0

[✓] Connected device (3 available)
    • iPhone 15 Pro (mobile) • 9E000980-FB8A-459B-86AD-0AECD6B15485 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 124.0.6367.61
    ! Error: Browsing on the local area network for Canyon's Developer iPhone. Ensure the device is unlocked and attached with a cable or associated with the same
      local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for Canyon's iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for Canyon’s Apple Watch. Ensure the device is unlocked and discoverable via Bluetooth. (code -27)
    ! Error: Browsing on the local area network for DavidiPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

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

• No issues found!

I don’t know why this is happening.

  1. I’ve removed all pub dependencies that are not compatible with web.
  2. I’ve run flutter clean
  3. I’ve updated all pub dependencies
  4. I’ve done research on this topic. Nothing that really matches my problem popped up.

Thank you for the help!

2

Answers


  1. Chosen as BEST ANSWER

    I have no idea why this was causing these problems, however, @CMARIX's answer prompted me to look through my Firebase initialization code and the line below was commented out. I simply uncommented and boom, web was working again.

    await FirebaseAppCheck.instance.activate(
        webProvider: ReCaptchaV3Provider('site-key'), //this line was commented out
        androidProvider: kDebugMode ? AndroidProvider.debug : AndroidProvider.playIntegrity,
        appleProvider: AppleProvider.appAttest,
    );
    

    If anyone has any valuable information that would show why this fix contributed to the error, please let me know or append it to the answer!


  2. In my previous experiences working with web-related issues, I have encountered similar challenges. Through initial investigative steps outlined below, I have successfully identified and resolved such issues. Additionally, I have incorporated considerations based on your feedback that may contribute to the problem’s resolution.

    • Since you mentioned that it used to work on the web, think about any
      recent changes you’ve made to your codebase, especially those related
      to platform-specific code or dependencies.

    • The error you’re encountering, TypeError: Instance of ‘ArgumentError’: type ‘ArgumentError’ is not a subtype of type ‘JavaScriptObject’ suggests that there’s a type mismatch occurring somewhere in your code, particularly when interfacing with JavaScript. Review any code where you’re interacting with JavaScript,such as through dart:js or external JavaScript libraries. Ensure that the types being passed match what’s expected.

    • _flutterfire_internals.dart.lib.js indicating that the error might be related to FlutterFire, which is a set of Flutter plugins that enable Firebase support. If you’re using FlutterFire, review your integration and ensure it’s compatible with the web.

    • If you have platform-specific code that’s executed differently on web
      versus other platforms, ensure that it’s properly handling
      web-specific cases.

    Carefully reviewing your code, you should be able to identify and resolve the type error causing the problem.

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