2

Whenever I use the command flutter clean or flutter run, the window "The Dart Analyzer has terminated." pops up in VS Code. For flutter run I can specify that the analyzer terminates when it says "Running Gradle task 'assembleDebug'" in the console.

Here is the log after running flutter clean: https://hastebin.com/osovilenaj.swift

Can someone tell me the reason for this behaviour? I can simply click on restart, but it is annoying during my workflow.

PlutoHDDev
  • 540
  • 7
  • 25
  • some time it happens when vscode needs a restart. Try manually restarting vscode. Also first check for update – Taha Malik Nov 22 '20 at 09:55

2 Answers2

0

Try to update and restart both PC and VSCode, see if the problem persist.

It generally used to happen to me when either my CPU is doing too much work or the RAM is exhausted, see if you have same problem either with CPU or RAM use a real device to test with USB Debugging enabled instead of Emulator.

also this might also help VSCode dart analyzer stopped recognizing flutter/dart code

Akshit Ostwal
  • 451
  • 3
  • 14
  • I have this problem since a few weeks, so I have already restarted my PC and VS Code many times. My CPU and RAM usage when I run flutter run: https://ibb.co/CJrNwck I am using my phone instead of an Emulator already. I am on the latest VS Code version. – PlutoHDDev Nov 22 '20 at 11:07
  • so the Dart analyser must be stopping when your CPU Usage reaches 100% or near 100% I guess?? – Akshit Ostwal Nov 22 '20 at 11:13
  • I just ran it again and now I am far away from 100% usage: https://ibb.co/JKs0K1V , but the analyzer still terminates. – PlutoHDDev Nov 22 '20 at 11:20
  • Its a little bit strange as I can see you have 16gigs of RAM you must not encounter this problem – Akshit Ostwal Nov 22 '20 at 11:24
  • @PlutoHDDev check the link that I have recently added it might help.. – Akshit Ostwal Nov 22 '20 at 11:26
  • That's right, it's not video editing, it's just programming and running apps on my phone... A friend of mine is working on the same app (->GitHub) and he doesn't have this problem. – PlutoHDDev Nov 22 '20 at 11:28
  • You can also try reinstalling dart, there might some error in the PATH .. – Akshit Ostwal Nov 22 '20 at 11:30
  • I already reinstalled Flutter and Dart in the VS Code Extensions. Do I also have to reinstall dart somewhere else? Which link do you mean? – PlutoHDDev Nov 22 '20 at 11:31
  • https://stackoverflow.com/questions/54488236/vscode-dart-analyzer-stopped-recognizing-flutter-dart-code this one – Akshit Ostwal Nov 22 '20 at 11:42
  • not talking about extensions, talking about dart SDK try to reinstall it – Akshit Ostwal Nov 22 '20 at 11:43
  • I now installed the dart-sdk (before I just had the flutter dart-sdk), moved it above the flutter dart-sdk in my PATH variable and also configured the paths in the dart extension. I also deleted the flutter cache folder and let flutter install all that again using flutter doctor. After a restart... no change. Do you have another idea? – PlutoHDDev Nov 24 '20 at 19:51
  • Nothing more coming to my mind for now, until than you can also raise an issue on flutter Github there some more people can look into it. – Akshit Ostwal Nov 25 '20 at 05:47
0

Since something (Dart?) has been updated the error does not occurre anymore.

PlutoHDDev
  • 540
  • 7
  • 25