Command doesn't works after upgrade flutter

In my case Flutter had unstaged changes (since it uses git), so I needed to stash or reset it to be able to upgrade it.

Go to flutter's path and:

git add -A
git reset --hard

Alternatively, you can use --force to upgrade it anyway.

flutter upgrade --force

Open your Terminal in Android Studio or CMD and Paste it

flutter upgrade --force

I encountered the same problem. This probably occurred because I have my flutter SDK installed in the E:\ directory rather than default C:\ directory. This is how I solved it,

1: Check where your Flutter Sdk is present. You can do this by creating a "New project->Flutter->Flutter Sdk" (This works if you have the flutter Sdk installed and configured, If you don't have it installed you can click on install Sdk option in the same "new Project->Flutter" window).

2: Then open Terminal by going to bottom right corner of you IDE and then clicking on terminal.

3: Change your directory to the flutter sdk's bin location by Typing "cd _yourSdkLocation\bin". Here replace "_yourSdkLocation" with the directory address where your flutter Sdk is present.

4: Then run "flutter upgrade --force"