68

I'm new in Flutter. 2 months ago I have installed flutter SDK in windows. Now I have seen a lot of updates available.

I want to update "Flutter SDK".

How to update Flutter SDK to the latest version?

Khurshid Ansari
  • 4,638
  • 2
  • 33
  • 52

9 Answers9

120

You can write

flutter upgrade 

command in terminal to update flutter sdk

Khurshid Ansari
  • 4,638
  • 2
  • 33
  • 52
Viren V Varasadiya
  • 25,492
  • 9
  • 45
  • 61
  • Thanks for your answer. flutter upgrade update but not latest version. Latest version is 0.7.5 (https://github.com/flutter/flutter/releases) but after flutter upgrade, it update to 0.6.0 not 0.7.5. – Khurshid Ansari Sep 02 '18 at 09:00
  • 1
    May be you are in beta channel. You can check using flutter channel command. If you want to change channel the use flutter channel dev after that use flutter upgrade command to upgrade to latest version. – Viren V Varasadiya Sep 02 '18 at 11:04
  • Will this upgrade to the stable version or the dev version by default? – Najeeb Nov 21 '19 at 06:12
  • No, it will only update to the latest version of whatever channel you are using. – Viren V Varasadiya Nov 21 '19 at 06:23
  • 'flutter' is not recognized as an internal or external command, operable program or batch file. – Taba May 09 '20 at 03:52
  • May be you didn't set your sdk path correctly. @Taba – Viren V Varasadiya May 09 '20 at 03:56
  • well actually I was updating it using the "flutter upgrade" Button in `pubspec.yaml` file in android studio before, but after `android studio version 3.6.3` the button disappeared. and now when I try to run `flutter upgrade` in cmd even when I change the directory to flutter sdk yet I get the above error. Where should I place the SDK? – Taba May 09 '20 at 04:41
  • You need to set flutter SDK path using like bellow export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin" @Taba – PuNeet Pal Mar 04 '21 at 17:30
36

I want to upgrade most latest version. So I used below commands:

flutter channel dev

Flutter has 4 project branches / channels ie stable, master, dev, beta. First when we install it. flutter install stable channel.

If you want to switch :

flutter channel chanel_name

Then update that :

flutter upgrade
Khurshid Ansari
  • 4,638
  • 2
  • 33
  • 52
14

Open your terminal and type

flutter upgrade --force
Malith Ileperuma
  • 926
  • 11
  • 27
  • 1
    This worked for me when "flutter upgrade" didn't. What does --force do? – buttonsrtoys May 25 '20 at 19:19
  • `--force` overwrites local changes to your Flutter installation. As per the CLI: "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." – Elad Nava Sep 14 '22 at 22:30
10

Using Tool Menu:

You can update in android studio using Tools so follow these steps Android Studio -> Tools -> Flutter -> Flutter Upgrade.

enter image description here

Using Command:

You can write a command in the terminal to update flutter SDK

flutter upgrade 

Or if you have to upgrade it any way you can use

flutter upgrade --force
Hamza Khalid
  • 191
  • 1
  • 7
8

Sometime flutter upgrade seems not responsive but actually it's doing something. Just add the -v or --verbose option to see what actually happening.

flutter upgrade --verbose
Mazin Luriahk
  • 828
  • 8
  • 9
6

We can upgrade the flutter by simply using Flutter command forcefully.

Like this one :

flutter upgrade --force

But before that we will have to make sure & take a note of few things otherwise it can be risky & we might loss some of our work as well.

Important Note :

  • While upgrading the flutter make sure all of your local work is already pushed to the server & you do have a proper back up of all of your code
  • Make sure you do have a back of all live changes you did & with working condition

Hopefully this will help out everyone.

Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
3

A very much simple way is to go and download the new SDK and extract the the folder. Then replace the old sdk folder with the new one

Khurshid Ansari
  • 4,638
  • 2
  • 33
  • 52
ikben
  • 4,246
  • 4
  • 21
  • 27
1

Just run the flutter upgrade in terminal.

Or if you have to upgrade it any way you can use flutter upgrade --force

Dinith
  • 839
  • 14
  • 22
1

In Android Studio , in toolbar at top of the screen go to Android Studio -> Tools -> Flutter -> Flutter Upgrade.[Tools -> Flutter -> Flutter Upgrade.

Or open terminal and type command: flutter upgrade and hit Enter.

Shiva Yadav
  • 72
  • 1
  • 9