Home > Back-end >  How to specify local Flutter version (e.g. an older release)?
How to specify local Flutter version (e.g. an older release)?

Time:11-07

I would like to test my application / package running on an older version of Flutter, e.g. specifically Flutter v2.2.3.

There are 2 commands, flutter upgrade and flutter downgrade which might seem to be relevant, but how do I select the specific version of Flutter I want to use? flutter upgrade --help and flutter downgrade --help do not provide any extra information.

CodePudding user response:

Recommended (git): Just checking out a specific commit in the Flutter repo

  • Change directory to your flutter installation folder, e.g. /opt/flutter.
  • git checkout the git tag (change to the branch pointed by the tag). For example, there is a git tag called 2.5.0 for the version 2.5.0, so run git checkout 2.5.0. (Thanks Eugene :) )
    • Or alternatively, if I want version 2.5.0, I can get the commit SHA (ref) from the Flutter SDK releases page. That website says the ref for 2.5.0 is 4cc385b. At the flutter installation directory, run git checkout 4cc385b.
  • Then in the terminal, run flutter (or any specific flutter command) to download and build this version of flutter.

Using FVM (Flutter version Management)

  • You also specify the specific version of Flutter using FVM, e.g. fvm use 2.5.1

Download the specific version of Flutter from Flutter SDK releases and install it.

  • This is the slowest way, as you would have to download the entire repo again.

CodePudding user response:

Just download that specific flutter version from here. and just set the flutter version in your editor and try to run it will run that specific flutter version but make sure you can't run that with terminal commands. So you need to handle all commands from the Tools option.

set flutter version

Must Run commands from here

  • Related