此错误大约在一天前开始,当时我正在开发自己的应用程序,但休息了一段时间。然后突然,当我尝试在iOS模拟器上运行我的应用程序时,它没有运行。
这是输出:
Unhandled exception:
Crash when compiling
file:///Users/aaryanpatnaik/Documents/Flutter%20SDK/flutter/packages/flutter/lib/src/widgets/widg
et_inspector.dart,
at character offset 26588:
Bad state: No element
#0 List.single (dart:core-patch/growable_array.dart:260:22)
#1 ClassBuilderImpl.buildTypesWithBuiltArguments
(package:front_end/src/fasta/builder/class_builder.dart:568:43)
#2 ClassBuilderImpl.buildType
(package:front_end/src/fasta/builder/class_builder.dart:623:12)
#3 NamedTypeBuilder.build
(package:front_end/src/fasta/builder/named_type_builder.dart:275:24)
#4 FunctionTypeBuilder.build
(package:front_end/src/fasta/builder/function_type_builder.dart:81:21)
#5 BodyBuilder.buildDartType (package:front_end/src/fasta/kernel/body_builder.dart:6285:11)
#6 BodyBuilder.endFormalParameter
(package:front_end/src/fasta/kernel/body_builder.dart:3480:7)
#7 Parser.parseFormalParameter
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:1632:14)
#8 Parser.parseOptionalNamedParameters
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:1704:11)
#9 Parser.parseFormalParametersRest
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:1342:17)
#10 Parser.parseFormalParameters
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:1316:12)
#11 Parser.parseFormalParametersOpt
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:1276:15)
#12 DietListener.buildFunctionBody
(package:front_end/src/fasta/source/diet_listener.dart:976:22)
#13 DietListener._endClassMethod
(package:front_end/src/fasta/source/diet_listener.dart:714:5)
#14 DietListener.endMixinMethod (package:front_end/src/fasta/source/diet_listener.dart:679:5)
#15 Parser.parseMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3809:20)
#16 Parser.parseClassOrMixinOrExtensionMemberImpl
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:3546:15)
#17 Parser.parseClassOrMixinOrExtensionBody
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:3220:15)
#18 Parser.parseMixin (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2100:13)
#19 Parser.parseTopLevelKeywordDeclaration
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:619:18)
#20 Parser.parseTopLevelDeclarationImpl
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:476:14)
#21 Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:356:15)
#22 SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:427:14)
<asynchronous suspension>
#23 Loader.buildBodies (package:front_end/src/fasta/loader.dart:242:15)
<asynchronous suspension>
#24 KernelTarget.buildComponent.<anonymous closure>
(package:front_end/src/fasta/kernel/kernel_target.dart:382:20)
#25 withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#26 KernelTarget.buildComponent
(package:front_end/src/fasta/kernel/kernel_target.dart:380:12)
#27 IncrementalCompiler.computeDelta.<anonymous closure>
(package:front_end/src/fasta/incremental_compiler.dart:274:28)
<asynchronous suspension>
#28 IncrementalCompiler.computeDelta.<anonymous closure>
(package:front_end/src/fasta/incremental_compiler.dart)
#29 CompilerContext.runInContext.<anonymous closure>.<anonymous closure>
(package:front_end/src/fasta/compiler_context.dart:123:46)
#30 new Future.sync (dart:async/future.dart:223:31)
#31 CompilerContext.runInContext.<anonymous closure>
(package:front_end/src/fasta/compiler_context.dart:123:19)
#32 _rootRun (dart:async/zone.dart:1190:13)
#33 _CustomZone.run (dart:async/zone.dart:1093:19)
#34 _runZoned (dart:async/zone.dart:1630:10)
#35 runZoned (dart:async/zone.dart:1550:10)
#36 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#37 IncrementalCompiler.computeDelta
(package:front_end/src/fasta/incremental_compiler.dart:206:20)
#38 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:69:46)
#39 FrontendCompiler.compile.<anonymous closure>
(package:frontend_server/frontend_server.dart:524:59)
#40 new Future.<anonymous closure> (dart:async/future.dart:175:37)
#41 _rootRun (dart:async/zone.dart:1182:47)
#42 _CustomZone.run (dart:async/zone.dart:1093:19)
#43 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#44 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#45 _rootRun (dart:async/zone.dart:1190:13)
#46 _CustomZone.run (dart:async/zone.dart:1093:19)
#47 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1021:23)
#48 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#49 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
#50 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
#51 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
#0 DietListener.buildFunctionBody
(package:front_end/src/fasta/source/diet_listener.dart:998:7)
#1 DietListener._endClassMethod
(package:front_end/src/fasta/source/diet_listener.dart:714:5)
#2 DietListener.endMixinMethod (package:front_end/src/fasta/source/diet_listener.dart:679:5)
#3 Parser.parseMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3809:20)
#4 Parser.parseClassOrMixinOrExtensionMemberImpl
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:3546:15)
#5 Parser.parseClassOrMixinOrExtensionBody
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:3220:15)
#6 Parser.parseMixin (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2100:13)
#7 Parser.parseTopLevelKeywordDeclaration
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:619:18)
#8 Parser.parseTopLevelDeclarationImpl
(package:_fe_analyzer_shared/src/parser/parser_impl.dart:476:14)
#9 Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:356:15)
#10 SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:427:14)
<asynchronous suspension>
#11 Loader.buildBodies (package:front_end/src/fasta/loader.dart:242:15)
<asynchronous suspension>
#12 KernelTarget.buildComponent.<anonymous closure>
(package:front_end/src/fasta/kernel/kernel_target.dart:382:20)
#13 withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#14 KernelTarget.buildComponent
(package:front_end/src/fasta/kernel/kernel_target.dart:380:12)
#15 IncrementalCompiler.computeDelta.<anonymous closure>
(package:front_end/src/fasta/incremental_compiler.dart:274:28)
<asynchronous suspension>
#16 IncrementalCompiler.computeDelta.<anonymous closure>
(package:front_end/src/fasta/incremental_compiler.dart)
#17 CompilerContext.runInContext.<anonymous closure>.<anonymous closure>
(package:front_end/src/fasta/compiler_context.dart:123:46)
#18 new Future.sync (dart:async/future.dart:223:31)
#19 CompilerContext.runInContext.<anonymous closure>
(package:front_end/src/fasta/compiler_context.dart:123:19)
#20 _rootRun (dart:async/zone.dart:1190:13)
#21 _CustomZone.run (dart:async/zone.dart:1093:19)
#22 _runZoned (dart:async/zone.dart:1630:10)
#23 runZoned (dart:async/zone.dart:1550:10)
#24 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#25 IncrementalCompiler.computeDelta
(package:front_end/src/fasta/incremental_compiler.dart:206:20)
#26 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:69:46)
#27 FrontendCompiler.compile.<anonymous closure>
(package:frontend_server/frontend_server.dart:524:59)
#28 new Future.<anonymous closure> (dart:async/future.dart:175:37)
#29 _rootRun (dart:async/zone.dart:1182:47)
#30 _CustomZone.run (dart:async/zone.dart:1093:19)
#31 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#32 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#33 _rootRun (dart:async/zone.dart:1190:13)
#34 _CustomZone.run (dart:async/zone.dart:1093:19)
#35 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1021:23)
#36 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#37 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
#38 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
#39 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.
Running Xcode build...
这是颤振医生-v的结果:
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.5 19F101, locale en-US)
• Flutter version 1.22.2 at /Users/aaryanpatnaik/Documents/Flutter SDK/flutter
• Framework revision 84f3d28555 (12 days ago), 2020-10-15 16:26:19 -0700
• Engine revision b8752bbfff
• Dart version 2.10.2
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.1, Build version 12A7403
• CocoaPods version 1.10.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] Connected device (1 available)
• iPhone 12 Pro Max (mobile) • 66EABD02-5EF6-41F6-BFDB-181F67E6ED57 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-1
(simulator)
! Doctor found issues in 2 categories.
我还尝试打开一个新项目(不添加代码,仅添加示例项目),并尝试运行flutter,并输出相同的结果。