Skip to content

Bug Report: dart2wasm crash in ParameterInfo.fromMember during DispatchTable.build #62273

@rpk98c

Description

@rpk98c

Environment
Dart SDK: 3.10.4 (stable) and 3.11.0-200.1.beta
Flutter: 3.38.5 (stable) and 3.40.0-0.1.pre (beta)
OS: macOS (darwin arm64)

Description
When attempting to compile a Flutter web application to WebAssembly using flutter build web --wasm, the dart2wasm compiler crashes with a null check error during the dispatch table building phase.

Error Output
Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 255:
Unhandled exception:
Null check operator used on a null value
#0 new ParameterInfo.fromMember (package:dart2wasm/param_info.dart:90)
#1 _parameterInfoFromReferences (package:dart2wasm/dispatch_table.dart:944)
#2 DispatchTable.build. (package:dart2wasm/dispatch_table.dart:723)
#3 _LinkedHashMapMixin.forEach (dart:_compact_hash:765)
#4 DispatchTable.build (package:dart2wasm/dispatch_table.dart:663)
#5 Translator.translate (package:dart2wasm/translator.dart:560)
#6 compileToModule (package:dart2wasm/compile.dart:359)

#7 generateWasm (package:dart2wasm/generate_wasm.dart:81)

#8 main (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/dart2wasm/bin/dart2wasm.dart:10)

Steps to Reproduce
Build a Flutter web app with the following dependencies:

  • firebase_core, firebase_auth, cloud_firestore
  • google_maps_flutter
  • flutter_bloc
  • cached_network_image
  • Various other common Flutter packages

Run flutter build web --wasm

Compiler crashes during dispatch table building

What Works
Regular web build (flutter build web) compiles successfully
The app runs correctly in JS-compiled web mode

Packages Tested/Ruled Out
We systematically removed these packages and the crash persists:

  • flutter_map
  • mqtt_client
  • mandrill

Additional Context
The project was recently migrated from dart:html to package:web for WASM compatibility
All conditional exports use dart.library.js_interop
The crash occurs in both stable (3.38.5) and beta (3.40.0) channels

Expected Behaviour
The compiler should either:
Successfully compile the application to WASM, or
Provide a meaningful error message indicating which code construct is incompatible

Actual Behaviour
The compiler crashes with an internal null check failure, providing no information about which source code is triggering the issue.

Metadata

Metadata

Assignees

Labels

area-dart2wasmIssues for the dart2wasm compiler.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions