'How can I fix "Checking Dart SDK version... << was unexpected at this time" error in Flutter?
I am facing an issue any time I try to run any app or flutter command from the terminal, this is displayed: Checking Dart SDK version... << was unexpected at this time.
Not even flutter doctor works.
Nothing seems to work and it's so frustrating as it happened out of the blue. One moment everything was fine, now nothing works. Any help will be appreciated
Solution 1:[1]
I've resolved this error with the below steps:
Go to C:\Users\{Name}\.gradle} - Delete the
.gradledirectory.Then Download and install the same flutter and dart SDK version in some other location and set the environment variables.
Example:
Environment variables Before :
("D:\FlutterExtractedFiles\flutter\bin") ("D:\FlutterExtractedFiles\flutter\bin\cache\dart-sdk\bin")`Environment variables After :
("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin") ("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin\cache\dart-sdk\bin")Then check the Android Studio event log
Solution 2:[2]
Flutter reinstalled worked for me..
delete flutter folder in C directroy.
make a
srcfolder in C: directory.GoTo cmd and install flutter from official flutter github repo
C:\src>git clone https://github.com/flutter/flutter.git -b stablerun flutter doctor
set env path.
DONE
Solution 3:[3]
What worked in my case was deleting the .gradle file (C:\Users\USER.gradle) and reinstalling Flutter in another location and changing the PATH to it.
Solution 4:[4]
you should try this
restart your pc and delete the flutter folder in C directory then reinstall flutter and run flutter doctor
Solution 5:[5]
For me, the following steps resolved the problem:
- Open cmd and run flutter doctor. (if there is an issue resolve them first.)
- If not then change the flutter channel to dev. Whatever your channel is?. If this is the dev channel then change to master channel.
- Again flutter doctor. If everything goes perfectly. then run your project. If it runs accordingly then again change to channel to stable.
Solution 6:[6]
I faced this error before, all I had to do was to:
- Remove Flutter from my C directory.
- Install Flutter from the official website.
- Run Flutter doctor:
flutter doctor
No need for changing the PATH or any further actions.
If it worked fine with you then you are all done!
I faced another error after it, related to the Dart SDK and solved it using this link
the key is to install Android SDK Command-line Tools, steps being: Open Android Studio Tools Menu, SDK Manager In the window that comes up there are inner panels, choose SDK Tools panel Tick Android SDK Command-line Tools Choose Apply button near the bottom of the window At that point, you will be prompted to accept the SDK license and the command line tools will be installed. Your license issue should now be resolved.
Solution 7:[7]
If your using Intelij and get the << error and none of the above work.
Delete the .intelij folder in your project and reopen the folder in intelij.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joachim Sauer |
| Solution 2 | Toujo |
| Solution 3 | Thilo Jaeggi |
| Solution 4 | Nilrajsinh Vaghela |
| Solution 5 | Dharman |
| Solution 6 | |
| Solution 7 | Emile |

