flutterdart

Flutter error `xxxx was unexpected at this time.`


I tried to upgrade Flutter version to the latest (flutter_windows_3.29.2-stable) on my Windows machine and got the following error.

f73bfc4522dd0bc87bbcdb4bb3088082755c5e87 was unexpected at this time.

Now I cannot run any Flutter command as this error pops up. I tried many different things and nothing seemed to fix the issue. Things I tried are,

  1. Go to the Flutter SDK folder and run git reset --hard
  2. Checked if the dart.flutterSdkPath is correct
  3. Completely delete the Flutter SDK folder and reinstall Flutter again
  4. Downgrade Flutter to a lower version (same error but with a different string at the beginning)

I am developing Flutter/Dart apps through VScode. Any help resolving this would be much appreciated.


Solution

  • I've finally managed to find the source of the issue. It was an issue with Windows Powershell incorrectly calling the git and therefore all the flutter commands are incorrectly editing the engine.version file inside Flutter SDK.

    Both command line and Git bash were calling the git correctly, but only Powershell was doing it incorrectly. So, followed that to the System32 folder and found that there is an empty file called git in there which is being called by Powershell instead of the correct path set in the Environment variables. Simply deleting that file fixed the issue (not sure how that file got there in the first place).