-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hi,
Working on one of my Dart projects a few days ago I started to regularly see the exception below when I try to compile the project. It happens when I run a Flutter application in debug mode but also when I run a Dart unit test (without Flutter dependencies, therefore I assume the cause is not Flutter related). After cleaning the project (by deleting the .dart_tool directory and running dart pub get), I can run the test or application again. But then if I change anything in the code and try to run it again, I get the same exception (and need to clean again before retrying).
I am not sure how to go about resolving this problem. I assume I added something to the code at some point that triggers these crashes. However, the code base is quite large, split to several packages, hard to narrow down to what the cause may be. The error message and the stack trace does not give me any pointers to where in my code the problem originates from.
I may start looking into how to run the Dart compiler in debug mode and see if I can figure out more, but that seems like a huge task to get going with. I thought I could first ask the question here, maybe I get some directions...
Thanks!
Unhandled exception:
Crash when compiling:
Null check operator used on a null value
#0 TypeBuilderComputer.visitTypeParameterType (package:front_end/src/fasta/kernel/type_builder_computer.dart:179:50)
#1 TypeParameterType.accept (package:kernel/ast.dart:12528:42)
#2 TypeBuilderComputer.visitFunctionType (package:front_end/src/fasta/kernel/type_builder_computer.dart:131:46)
#3 FunctionType.accept (package:kernel/ast.dart:11481:42)
#4 DillLoader.computeTypeBuilder (package:front_end/src/fasta/dill/dill_loader.dart:338:17)
#5 DillTypeAliasBuilder.type (package:front_end/src/fasta/dill/dill_type_alias_builder.dart:62:44)
#6 TypeAliasBuilderImpl.unaliasDeclaration (package:front_end/src/fasta/builder/type_alias_builder.dart:234:58)
#7 SourceTypeAliasBuilder.buildTypedefTearOffs (package:front_end/src/fasta/source/source_type_alias_builder.dart:248:43)
#8 SourceLibraryBuilder.installTypedefTearOffs (package:front_end/src/fasta/source/source_library_builder.dart:5152:19)
#9 SourceLoader.installTypedefTearOffs (package:front_end/src/fasta/source/source_loader.dart:1837:17)
#10 KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:516:14)
<asynchronous suspension>
#11 withCrashReporting (package:front_end/src/fasta/crash.dart:133:12)
<asynchronous suspension>
#12 KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:404:12)
<asynchronous suspension>
#13 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:408:33)
<asynchronous suspension>
#14 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:75:50)
<asynchronous suspension>
#15 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:604:11)
<asynchronous suspension>
#16 listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1316:11)
<asynchronous suspension>
> flutter doctor -v
[√] Flutter (Channel stable, 3.13.2, on Microsoft Windows [Version 10.0.22621.2215], locale en-US)
• Flutter version 3.13.2 on channel stable at C:\Users\mapro\development\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ff5b5b5fa6 (12 days ago), 2023-08-24 08:12:28 -0500
• Engine revision b20183e040
• Dart version 3.1.0
• DevTools version 2.25.0
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\mapro\AppData\Local\Android\Sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = C:\Users\mapro\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.6.33829.357
• Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• 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.6+0-b2043.56-9586694)
[√] IntelliJ IDEA Community Edition (version 2023.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.3.1
• Flutter plugin version 75.1.4
• Dart plugin version 232.9559.10
[√] VS Code (version 1.81.1)
• VS Code at C:\Users\mapro\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.68.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2215]
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.141
• Edge (web) • edge • web-javascript • Microsoft Edge 115.0.1901.203
[√] Network resources
• All expected network resources are available.
• No issues found!