Skip to content

dart2js crash (go_router problem?): Operand of null-aware operation '!' has type 'String' which excludes null #53291

Description

@Alexqwesa

What didn't work:
flutter build web
Happens both times: with local build, and in github action (https://github.com/Alexqwesa/ais3uson_app/actions/runs/5918034312/job/16046960775)

What works:

flutter run -d Chrome
flutter run -d linux
flutter build appbundle
flutter build apk
flutter build linux

Output of flutter build web:


Target dart2js failed: ProcessException: Process exited abnormally:
../../.pub-cache/hosted/pub.dev/go_router-10.0.0/lib/src/information_provider.dart:125:34:
Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
      location: routeInformation.location!,
                                 ^
../../.pub-cache/hosted/pub.dev/go_router-10.0.0/lib/src/parser.dart:87:50:
Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
        configuration.findMatch(routeInformation.location!, extra: state.extra);
                                                 ^
file:///home/alex/AndroidStudioProjects/ais3uson_app/.dart_tool/flutter_build/0a29fdf56dfc3214f350e0e2ab50d35c/main.dart:
Internal Error: The compiler crashed when compiling this element.

The compiler is broken.

When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.

The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.

Please include the following information:

* the name and version of your operating system,

* the Dart SDK build number (3.1.0), and

* the entire message you see here (including the full stack trace
  below as well as the source location above).

The compiler crashed: Invalid argument(s): Type parameter TypeParameter(T) is not indexed
#0      TypeParameterIndexer.[] (package:kernel/binary/ast_to_binary.dart:3371:8)
#1      BinaryPrinter.visitTypeParameterType (package:kernel/binary/ast_to_binary.dart:2528:38)
#2      TypeParameterType.accept (package:kernel/ast.dart:12528:42)
#3      BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#4      BinaryPrinter.writeNodeList (package:kernel/binary/ast_to_binary.dart:349:7)
#5      BinaryPrinter.visitInterfaceType (package:kernel/binary/ast_to_binary.dart:2435:7)
#6      InterfaceType.accept (package:kernel/ast.dart:11385:42)
#7      BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#8      BinaryPrinter.visitAsExpression (package:kernel/binary/ast_to_binary.dart:1960:5)
#9      AsExpression.accept (package:kernel/ast.dart:7636:44)
#10     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#11     BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:531:7)
#12     BinaryPrinter.visitReturnStatement (package:kernel/binary/ast_to_binary.dart:2315:5)
#13     ReturnStatement.accept (package:kernel/ast.dart:10127:43)
#14     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:439:10)
#15     BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:531:7)
#16     BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:1529:5)
#17     FunctionNode.accept (package:kernel/ast.dart:3908:38)
#18     BinaryPrinter.writeFunctionNode (package:kernel/binary/ast_to_binary.dart:446:10)
#19     BinaryPrinter.visitProcedure (package:kernel/binary/ast_to_binary.dart:1357:5)
#20     Procedure.accept (package:kernel/ast.dart:3311:40)
#21     BinaryPrinter.writeProcedureNode (package:kernel/binary/ast_to_binary.dart:467:10)
#22     BinaryPrinter.writeProcedureNodeList (package:kernel/binary/ast_to_binary.dart:358:7)
#23     BinaryPrinter.visitClass (package:kernel/binary/ast_to_binary.dart:1260:5)
#24     Class.accept (package:kernel/ast.dart:1422:38)
#25     BinaryPrinter.writeClassNode (package:kernel/binary/ast_to_binary.dart:481:10)
#26     BinaryPrinter.writeClassNodeList (package:kernel/binary/ast_to_binary.dart:376:7)
#27     BinaryPrinter.visitLibrary (package:kernel/binary/ast_to_binary.dart:1096:5)
#28     Library.accept (package:kernel/ast.dart:577:38)
#29     BinaryPrinter.writeLibraryNode (package:kernel/binary/ast_to_binary.dart:460:10)
#30     BinaryPrinter.writeLibraries (package:kernel/binary/ast_to_binary.dart:766:9)
#31     BinaryPrinter.writeComponentFile.<anonymous closure> (package:kernel/binary/ast_to_binary.dart:605:7)
#32     Timeline.timeSync (dart:developer/timeline.dart:171:22)
#33     BinaryPrinter.writeComponentFile (package:kernel/binary/ast_to_binary.dart:586:14)
#34     SerializationTask.serializeComponent.<anonymous closure> (package:compiler/src/serialization/task.dart:77:15)
#35     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#36     SerializationTask.serializeComponent (package:compiler/src/serialization/task.dart:67:5)
#37     Compiler.produceKernel (package:compiler/src/compiler.dart:422:29)
<asynchronous suspension>
#38     Compiler.runSequentialPhases (package:compiler/src/compiler.dart:711:20)
<asynchronous suspension>
#39     Compiler.runInternal.<anonymous closure> (package:compiler/src/compiler.dart:311:7)
<asynchronous suspension>
#40     Compiler.runInternal (package:compiler/src/compiler.dart:310:5)
<asynchronous suspension>
#41     Compiler.run.<anonymous closure> (package:compiler/src/compiler.dart:231:11)
<asynchronous suspension>
#42     main (package:compiler/src/dart2js.dart:1241:3)
<asynchronous suspension>
  Command: /home/alex/Android/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/alex/Android/flutter/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot
  --platform-binaries=/home/alex/Android/flutter/bin/cache/flutter_web_sdk/kernel --invoker=flutter_tool -Ddart.vm.product=true -DFLUTTER_WEB_AUTO_DETECT=true
  -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/1ac611c64eadbd93c5f5aba5494b8fc3b35ee952/ --native-null-assertions --no-source-maps -o
  /home/alex/AndroidStudioProjects/ais3uson_app/.dart_tool/flutter_build/0a29fdf56dfc3214f350e0e2ab50d35c/app.dill --packages=.dart_tool/package_config.json --cfe-only
  /home/alex/AndroidStudioProjects/ais3uson_app/.dart_tool/flutter_build/0a29fdf56dfc3214f350e0e2ab50d35c/main.dart
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:125:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:278:19)
<asynchronous suspension>
#2      Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:189:5)
<asynchronous suspension>
#3      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:853:9)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:525:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:525:21)
<asynchronous suspension>
#7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:791:32)
<asynchronous suspension>
#8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:620:16)
<asynchronous suspension>
#9      WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:89:34)
<asynchronous suspension>
#10     BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:198:5)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1297:27)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#13     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:339:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:285:5)
<asynchronous suspension>
#17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:115:9)
<asynchronous suspension>
#18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#19     main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>

Compiling lib/main.dart for the Web...                             11.9s
Exception: Failed to compile application for the Web.

flutter doctor --verbose

[✓] Flutter (Channel stable, 3.13.0, on openSUSE Leap 15.5 5.14.21-150500.55.12-default, locale en_US.UTF-8)
    • Flutter version 3.13.0 on channel stable at /home/alex/Android/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (vor 5 Tagen), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/alex/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /home/alex/Android/Sdk
    • Java binary at: /home/alex/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-1/223.8836.35.2231.10406996/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 15.0.7
    • cmake version 3.20.4
    • ninja version 1.10.0
    • pkg-config version 0.29.2

[✓] Android Studio (version 2022.3)
    • Android Studio at /home/alex/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-1/223.8836.35.2231.10406996
    • Flutter plugin version 74.0.3
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.75.1)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • openSUSE Leap 15.5 5.14.21-150500.55.12-default
    • Chrome (web)    • chrome • web-javascript • Google Chrome 116.0.5845.96

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

• No issues found!
Process finished with exit code 0```

Metadata

Metadata

Assignees

Labels

area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interop

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