Flutter

Unable to create dart snapshot for flutter tool

Output of `flutter doctor -v after running flutter upgrade

Building flutter tool...
Running pub upgrade...
Crash when compiling package:file/src/backends/local.dart,
at character offset null:
NoSuchMethodError: The getter 'next' was called on null.
Receiver: null
Tried calling: next
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
#1      defaultRecoveryStrategy (package:front_end/src/fasta/scanner/recover.dart:158:66)
#2      _tokenizeAndRecover (package:front_end/src/fasta/scanner.dart:88:21)
#3      scan (package:front_end/src/fasta/scanner.dart:67:10)
#4      SourceLoader.tokenize (package:front_end/src/fasta/source/source_loader.dart:172:28)
<asynchronous suspension>
#5      SourceLoader.buildOutline (package:front_end/src/fasta/source/source_loader.dart:199:26)
<asynchronous suspension>
#6      Loader.buildOutlines (package:front_end/src/fasta/loader.dart:175:13)
<asynchronous suspension>
#7      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:240:24)
<asynchronous suspension>
#8      withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#9      KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:237:12)
<asynchronous suspension>
#10     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:111:32)
<asynchronous suspension>
#11     withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#12     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:57:10)
<asynchronous suspension>
#13     generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:42:18)
<asynchronous suspension>
#14     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:131:20)
<asynchronous suspension>
#15     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:46)
#16     new Future.sync (dart:async/future.dart:224:31)
#17     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:19)
#18     _rootRun (dart:async/zone.dart:1124:13)
#19     _CustomZone.run (dart:async/zone.dart:1021:19)
#20     _runZoned (dart:async/zone.dart:1516:10)
#21     runZoned (dart:async/zone.dart:1463:12)
#22     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:119:12)
#23     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:129:10)
#24     generateKernel (package:front_end/src/kernel_generator_impl.dart:41:32)
<asynchronous suspension>
#25     kernelForComponent (package:front_end/src/api_prototype/kernel_generator.dart:83:17)
<asynchronous suspension>
#26     SingleShotCompilerWrapper.compileInternal (file:///E:/b/build/slave/Windows_Engine/build/src/third_party/dart/pkg/vm/bin/kernel_service.dart:186:11)
<asynchronous suspension>
#27     Compiler.compile.<anonymous closure> (file:///E:/b/build/slave/Windows_Engine/build/src/third_party/dart/pkg/vm/bin/kernel_service.dart:134:39)
#28     new Future.<anonymous closure> (dart:async/future.dart:176:37)
#29     _rootRun (dart:async/zone.dart:1120:38)
#30     _CustomZone.run (dart:async/zone.dart:1021:19)
#31     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#32     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#33     _rootRun (dart:async/zone.dart:1124:13)
#34     _CustomZone.run (dart:async/zone.dart:1021:19)
#35     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#36     Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#37     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#38     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#39     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)


#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
#1      defaultRecoveryStrategy (package:front_end/src/fasta/scanner/recover.dart:158:66)
#2      _tokenizeAndRecover (package:front_end/src/fasta/scanner.dart:88:21)
#3      scan (package:front_end/src/fasta/scanner.dart:67:10)
#4      SourceLoader.tokenize (package:front_end/src/fasta/source/source_loader.dart:172:28)
<asynchronous suspension>
#5      SourceLoader.buildOutline (package:front_end/src/fasta/source/source_loader.dart:199:26)
<asynchronous suspension>
#6      Loader.buildOutlines (package:front_end/src/fasta/loader.dart:175:13)
<asynchronous suspension>
#7      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:240:24)
<asynchronous suspension>
#8      withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#9      KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:237:12)
<asynchronous suspension>
#10     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:111:32)
<asynchronous suspension>
#11     withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#12     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:57:10)
<asynchronous suspension>
#13     generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:42:18)
<asynchronous suspension>
#14     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:131:20)
<asynchronous suspension>
#15     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:46)
#16     new Future.sync (dart:async/future.dart:224:31)
#17     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:19)
#18     _rootRun (dart:async/zone.dart:1124:13)
#19     _CustomZone.run (dart:async/zone.dart:1021:19)
#20     _runZoned (dart:async/zone.dart:1516:10)
#21     runZoned (dart:async/zone.dart:1463:12)
#22     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:119:12)
#23     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:129:10)
#24     generateKernel (package:front_end/src/kernel_generator_impl.dart:41:32)
<asynchronous suspension>
#25     kernelForComponent (package:front_end/src/api_prototype/kernel_generator.dart:83:17)
<asynchronous suspension>
#26     SingleShotCompilerWrapper.compileInternal (file:///E:/b/build/slave/Windows_Engine/build/src/third_party/dart/pkg/vm/bin/kernel_service.dart:186:11)
<asynchronous suspension>
#27     Compiler.compile.<anonymous closure> (file:///E:/b/build/slave/Windows_Engine/build/src/third_party/dart/pkg/vm/bin/kernel_service.dart:134:39)
#28     new Future.<anonymous closure> (dart:async/future.dart:176:37)
#29     _rootRun (dart:async/zone.dart:1120:38)
#30     _CustomZone.run (dart:async/zone.dart:1021:19)
#31     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#32     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#33     _rootRun (dart:async/zone.dart:1124:13)
#34     _CustomZone.run (dart:async/zone.dart:1021:19)
#35     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#36     Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#37     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#38     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#39     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

Error: Unable to create dart snapshot for flutter tool.

Solution:

In the Flutter install directory please run

git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor

Like

RECOMMENDED ARTICLES





Leave a Reply

Your email address will not be published.