-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dart compiler crash #60236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've been experiencing the same issue—I believe the error message I got is identical to the one above:
I didn't have any factory constructors, but I noticed that if I stop using extension types, the crash no longer occurs. |
@jensjoha did this fall through the cracks by chance? |
This started happening today. Unhandled exception:
Crash when compiling:
type 'Null' is not a subtype of type 'Library' in type cast
#0 ExtensionTypeDeclaration.enclosingLibrary (package:kernel/src/ast/declarations.dart:890)
#1 DillLibraryBuilder.finalizeExports (package:front_end/src/dill/dill_library_builder.dart:441)
#2 DillLibraryBuilder.ensureLoaded (package:front_end/src/dill/dill_library_builder.dart:202)
#3 DillExportNameSpace.ensureNameSpace (package:front_end/src/base/name_space.dart:311)
#4 LazyNameSpace._getables (package:front_end/src/base/name_space.dart:276)
#5 NameSpaceImpl.unfilteredNameIterator (package:front_end/src/base/name_space.dart:209)
#6 NameSpaceImpl.filteredNameIterator (package:front_end/src/base/name_space.dart:163)
#7 Import.finalizeImports (package:front_end/src/base/import.dart:95)
#8 SourceCompilationUnitImpl.addImportsToScope (package:front_end/src/source/source_compilation_unit.dart:834)
#9 SourceLibraryBuilder.addImportsToScope (package:front_end/src/source/source_library_builder.dart:650)
#10 SourceLoader.computeLibraryScopes (package:front_end/src/source/source_loader.dart:1547)
#11 KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/kernel/kernel_target.dart:506)
#12 withCrashReporting (package:front_end/src/base/crash.dart:139)
#13 KernelTarget.buildOutlines (package:front_end/src/kernel/kernel_target.dart:486)
#14 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/base/incremental_compiler.dart:408)
<asynchronous suspension>
#15 CompilerContext.clear (package:front_end/src/base/compiler_context.dart:77)
<asynchronous suspension>
#16 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:77)
<asynchronous suspension>
#17 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:642)
<asynchronous suspension>
#18 listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1401)
<asynchronous suspension>
2
the Dart compiler exited unexpectedly.
The app I'm trying to run (and that still worked on Friday) has this specified in the pubspec environment:
sdk: ^3.5.4 so it's not related to pub workspaces. If I recall correctly I did briefly experiment last week with setting a higher version constraint, because I want to eventually move to pub workspaces. Running I've also created a new project with |
For me, this error happend as combination of two things: Project has mixed style of imports - relative and package - but seems it doesn’t relate to issue. Every hot reload with small changes, for example add new property to row, or swap row to wrap, crashes the app. Tested on android emulators, API 36 and API 35 [✓] Flutter (Channel stable, 3.29.3, on macOS 15.4.1 24E263 darwin-arm64, locale en-US) [296ms] [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1,294ms] [✓] Android Studio (version 2025.1.1) [10ms] |
The Dart compiler sometimes crashes when making simple changes to a factory constructor, such as introducing a local variable instead of returning directly or modifying a class parameter. The issue happens so frequently that I have to restart the Flutter app more than 10 times an hour.
Steps to Reproduce
Changing a factory constructor from:
to:
causes the compiler to crash when saving the file.
Expected Behavior
The compiler should successfully recompile without crashing.
Actual Behavior
The Dart compiler crashes with the following error:
Environment
>=3.7.0 <4.0.0
The text was updated successfully, but these errors were encountered: