Skip to content

Flutter 3.44.0 web debug client.js crashes: _JsonMap is not a subtype of String during DWDS deserialization #2838

@max-anders

Description

@max-anders

Summary

After upgrading to Flutter 3.44.0 stable, running a Flutter web app in Chrome debug mode crashes the injected DWDS client.js script.
The app launches, but the browser console shows:

Unhandled error detected in the injected client.js script.
Deserializing to 'unspecified' failed due to:
TypeError: Instance of '_JsonMap': type '_JsonMap' is not a subtype of type 'String'
Hot reload / hot restart then disconnects or becomes unreliable.

Related issues checked

This looks related to #2553 / #2612 as another injected client.js DWDS crash, but I could not find an exact duplicate for:
Deserializing to 'unspecified' failed due to: TypeError: Instance of '_JsonMap': type '_JsonMap' is not a subtype of type 'String'
This happens on Flutter 3.44.0 stable, which bundles DWDS 26.2.5. Downgrading to Flutter 3.41.9, which bundles DWDS 26.2.3, avoids the issue.

Environment

Flutter 3.44.0 • channel stable
Dart 3.12.0
DevTools 2.57.0
OS: Arch Linux 7.0.10
Browser: Chromium 148.0.7778.178
Flutter bundled DWDS: 26.2.5

Command

flutter run -d chrome -t lib/main.dart --web-port 5000 --dart-define-from-file=.env.local

Expected behavior
The app should launch in Chrome with the injected debug client connected, and hot reload / hot restart should keep working.

Actual behavior
The injected client.js crashes with the _JsonMap is not a subtype of type String deserialization error.

After this, hot restart reports:

Recompile complete. No client connected.
Notes
Downgrading Flutter to 3.41.9 avoids the issue. That version bundles DWDS 26.2.3.

Flutter 3.44.0 bundles DWDS 26.2.5. DWDS 27.x changelog appears to contain related fixes around JSON/deserialization robustness, including:

Fix deserialization of HotRestartRequest / HotReloadResponse / HotRestartResponse / ServiceExtensionResponse
Make ExtensionEvent.fromJson robust to missing headers and Map-typed params
So this looks like a DWDS regression in the version bundled with Flutter 3.44.0 stable.

Workaround
Downgrade Flutter to 3.41.9 or move to a Flutter version that bundles DWDS 27.x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onneeds-infoAdditional information needed from the issue authorpackage:dwdstriagedtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions