How can I fix "Checking Dart SDK version... << was unexpected at this time" error in Flutter?

2,807

Solution 1

I've resolved this error with the below steps:

  1. Go to C:\Users\{Name}\.gradle} - Delete the .gradle directory.

  2. 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")
    
  3. Then check the Android Studio event log

    Android studio log

Solution 2

Flutter reinstalled worked for me..

  • delete flutter folder in C directroy.

  • make a src folder in C: directory.

  • GoTo cmd and install flutter from official flutter github repoC:\src>git clone https://github.com/flutter/flutter.git -b stable

    https://flutter.dev/docs/get-started/install/windows

  • run flutter doctor

  • set env path.

  • DONE

Solution 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

I faced this error before, all I had to do was to:

  1. Remove Flutter from my C directory.
  2. Install Flutter from the official website.
  3. 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 5

For me, the following steps resolved the problem:

  1. Open cmd and run flutter doctor. (if there is an issue resolve them first.)
  2. If not then change the flutter channel to dev. Whatever your channel is?. If this is the dev channel then change to master channel.
  3. Again flutter doctor. If everything goes perfectly. then run your project. If it runs accordingly then again change to channel to stable.
Share:
2,807
Tim Mwaura
Author by

Tim Mwaura

Updated on December 30, 2022

Comments

  • Tim Mwaura
    Tim Mwaura over 1 year

    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

  • Scratte
    Scratte over 2 years
    Stack Uses Markdown for formatting posts. Please see the Markdown help