dartflutter

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

  • 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