When creating a project, it immediately gives the following error
flutter doctor – OK!
Launching libmain.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.
android studio reinstall didn’t help.
in my case the solutions from this page do not work
StatelessWidget : Classes can only extend other classes.dart(extends_non_class) – issue
2
Answers
In my case, I got a similar error when:
You can also try running
flutter clean
in the terminal, and thenflutter pub get
. This works often in these kinds of situations.