当创建一个项目,它立即给出以下错误Flutter医生-确定!
enter image description here
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Unhandled exception:
Crash when compiling null,
at character offset null:
Unsupported operation: _ExplicitNamedTypeBuilder.registerInferredType
#0 TypeBuilder.registerInferredType (package:front_end/src/fasta/builder/type_builder.dart:350:5)
#1 DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals.performRecoveryForErroneousCase (package:front_end/src/fasta/source/source_constructor_builder.dart:355:23)
#2 DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals (package:front_end/src/fasta/source/source_constructor_builder.dart:375:14)
#3 DeclaredSourceConstructorBuilder.inferFormalTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:290:9)
#4 DeclaredSourceConstructorBuilder.inferTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:263:5)
#5 InferableTypeBuilder.inferType (package:front_end/src/fasta/builder/omitted_type_builder.dart:149:19)
#6 SourceLoader.performTopLevelInference (package:front_end/src/fasta/source/source_loader.dart:2358:19)
#7 KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:532:14)
<asynchronous suspension>
#8 withCrashReporting (package:front_end/src/fasta/crash.dart:122:12)
<asynchronous suspension>
#9 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:407:33)
<asynchronous suspension>
#10 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:68:50)
<asynchronous suspension>
#11 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:11)
<asynchronous suspension>
#12 listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1210:11)
<asynchronous suspension>
#0 TypeBuilder.registerInferredType (package:front_end/src/fasta/builder/type_builder.dart:350:5)
#1 DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals.performRecoveryForErroneousCase (package:front_end/src/fasta/source/source_constructor_builder.dart:355:23)
#2 DeclaredSourceConstructorBuilder.finalizeSuperInitializingFormals (package:front_end/src/fasta/source/source_constructor_builder.dart:375:14)
#3 DeclaredSourceConstructorBuilder.inferFormalTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:290:9)
#4 DeclaredSourceConstructorBuilder.inferTypes (package:front_end/src/fasta/source/source_constructor_builder.dart:263:5)
#5 InferableTypeBuilder.inferType (package:front_end/src/fasta/builder/omitted_type_builder.dart:149:19)
#6 SourceLoader.performTopLevelInference (package:front_end/src/fasta/source/source_loader.dart:2358:19)
#7 KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:532:14)
<asynchronous suspension>
#8 withCrashReporting (package:front_end/src/fasta/crash.dart:122:12)
<asynchronous suspension>
#9 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:407:33)
<asynchronous suspension>
#10 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:68:50)
<asynchronous suspension>
#11 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:11)
<asynchronous suspension>
#12 listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1210:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.
enter image description here
重新安装android studio没有帮助.
在我的情况下,这个页面的解决方案不起作用StatelessWidget : Classes can only extend other classes.dart(extends_non_class) - issue
2条答案
按热度按时间t40tm48m1#
在我的例子中,我得到了类似的错误,当:
pinkon5k2#
您也可以尝试在终端中运行
flutter clean
,然后再运行flutter pub get
,这通常适用于此类情况。