Skip to main content

Fix flutter upgrade Command Failed When Upgrading Flutter

With the launch of Flutter 3, Google is making it easier than ever for developers to create beautiful and responsive user interfaces for a range of devices. Flutter 3 supports six platforms, including Android, iOS, Windows, Mac, Linux, and the web.

This means that developers can now build for all these platforms from a single codebase, drastically reducing development time and costs. This is a huge benefit for startups who want to bring their ideas to market quickly and efficiently. The launch of Flutter 3 is sure to accelerate the already rapid adoption of this exciting toolkit.

Since Flutter 3 has been released, many developers are rushing to upgrade their codebase. However, some are facing difficulties with the process. One common issue is that the command flutter upgrade doesn’t work. An error message is thrown in Android Studio as below:

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is recommended that you stash them via "git stash" or else commit the changes to a local branch. If it is okay to
remove local changes, then re-run this command with "--force".

You can fix this by running either one of the 2 command line groups.

git add -A
git reset --hard
flutter upgrade --force

I used the 2nd one when upgrading to Flutter 3.

By continuing to use the site, you agree to the use of cookies.