Repository: flutter
Issue: [tool][dart] Crash in kernel compiler when building
Labels: tool,dependency: dart,P2,c: fatal crash,team-tool,triaged-tool

I recently updated to framework commit `ca788d8941abc469ee6cac70daff3dfd67d9e47e` (engine commit `c9dda84396f287720d82249b0a1571e0ad9b6a82`) on the main branch and triggered a windows build of an app. This appears to reproducibly crash with the same issue on any app, but I used [tvolkert/flutter_desktop_bug](https://github.com/tvolkert/flutter_desktop_bug).

During the kernel compile phase, the kernel compiler reproducibly crashes with the following details:

```
cbracken@cbracken0 MINGW64 /c/src/flutter_desktop_bug (main)
$ flutter run -d windows
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine c9dda84396f287720d82249b0a1571e0ad9b6a82...
Expanding downloaded archive...
Building flutter tool...
Running pub upgrade...
Downloading package sky_engine...                                  482ms
Downloading flutter_patched_sdk tools...                           454ms
Downloading flutter_patched_sdk_product tools...                   361ms
Downloading windows-x64 tools...                                 2,885ms
Downloading windows-x64/font-subset tools...                       268ms
Downloading windows-x64/windows-x64-flutter tools...                5.6s
Downloading windows-x64/flutter-cpp-client-wrapper tools...        166ms
Downloading windows-x64-profile/windows-x64-flutter tools...         4.7s
Downloading windows-x64-release/windows-x64-flutter tools...         4.7s
Running "flutter pub get" in flutter_desktop_bug...                636ms
Launching lib\main.dart on Windows in debug mode...
Unhandled exception:
Crash when compiling null,
at character offset null:
type 'StaticGet' is not a subtype of type 'ConstructorTearOff' in type cast
#0      getRedirectingFactories
(package:front_end/src/fasta/kernel/redirecting_factory_body.dart:41:43)
#4      LazyLibraryScope.ensureScope
(package:front_end/src/fasta/dill/dill_library_builder.dart:61:21)
#5      LazyScope._local (package:front_end/src/fasta/scope.dart:630:5)
#6      Scope.lookupLocalMember (package:front_end/src/fasta/scope.dart:408:38)
#7      DillLibraryBuilder.finalizeExports
(package:front_end/src/fasta/dill/dill_library_builder.dart:414:35)
#8      DillLibraryBuilder.ensureLoaded
(package:front_end/src/fasta/dill/dill_library_builder.dart:127:7)
#9      LazyLibraryScope.ensureScope
(package:front_end/src/fasta/dill/dill_library_builder.dart:61:21)
#10     LazyScope._local (package:front_end/src/fasta/scope.dart:630:5)
#11     Scope.forEach (package:front_end/src/fasta/scope.dart:528:5)
#12     SourceLoader.computeLibraryScopes
(package:front_end/src/fasta/source/source_loader.dart:1103:30)
#13     KernelTarget.buildOutlines.<anonymous closure>
(package:front_end/src/fasta/kernel/kernel_target.dart:408:14)
<asynchronous suspension>
#14     withCrashReporting (package:front_end/src/fasta/crash.dart:122:12)
<asynchronous suspension>
#15     IncrementalCompiler.computeDelta.<anonymous closure>
(package:front_end/src/fasta/incremental_compiler.dart:316:38)
<asynchronous suspension>
#16     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:69:29)
<asynchronous suspension>
#17     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:521:11)
<asynchronous suspension>
#18     listenAndCompile.<anonymous closure>
(package:frontend_server/frontend_server.dart:1135:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.
Building Windows application...                                        |
```

Doctor:
<details>

```
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 2.6.0-12.0.pre.511, on Microsoft Windows [Version 10.0.18363.1854], locale en-CA)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.11.3)
[√] Android Studio (version 4.1)
[√] VS Code (version 1.58.2)
[√] Connected device (4 available)

! Doctor found issues in 1 category.
```
</details>