Flutter SDK Versioning: how to run your Apps using different Flutter versions

Understanding the Flutter version management

Bernardo Iribarne
Nerd For Tech
3 min readApr 27, 2024

--

Photo by Eric Prouzet on Unsplash

Have you ever build two Apps at the same time? Or maybe you had to fix an issue or add new features to an old App while you were coding a new one. I’m sure yes and also more than one similar cases to those ones.

Environment issues

In such kind of situations you have to deal with your development environment. In Flutter we don’t have problems regarding dependencies because it manages it separately and it will not be an issue. But we are going to have issues if we’ve changed the Flutter SDK itself.

FVM comes to save our lives

FVM (Flutter version management) is the one that helps us to select the sdk version we want to use for an specific app, and seamlessly switch between versions as needed.

It gives us the ability to have all the sdk version we want and run an app using a specific sdk version. If you’ve ever worked with JAVA, it is the same approach for selecting the jvm when you have several jdk.

Installing the tool

I don’t want to write an installation tutorial, you can find all you need in the official site:

The site has all you need to get this tool working.

The only tip that I can give you is to add this to your PATH:

export PATH="$PATH:$HOME/.pub-cache/bin"

With that you will be able to run the tool

Using the FVM

Let’s create an empty flutter project.

flutter create fvm_example_app1
cd fvm_example_app1

Now you can set the sdk to be used for this project running this command:

fvm use 3.13.9

The fvm is going to get the sdk version if it is not installed yet and then add some configuration to your project. You will see something like this into your command line:

project 1 has been configured to use sdk 3.13.9

And now let’s create another app to use a different flutter sdk:

flutter create fvm_example_app2
cd fvm_example_app2

And set the last sdk we have:

fvm use 3.19.2

It cannot be so easy, right? This project is configured to use the last sdk:

project 2 has been configured to use the last sdk (3.19.2)

Running your app

It is very simple to run your app, you have to add “fvm” to the flutter commands. Let’s see some examples:

fvm flutter clean
fvm flutter pub get
fvm flutter run

And that’s all folks.

Conclusion

  1. Use FVM tool to be able to use any sdk when you want
  2. You will love use this tool, easy and powerful
  3. You will never have to worry about the Flutter version again
  4. Even if you don’t need it now, it will be very useful in the very near future.

Thanks for reading, Clap if you like it!

Photo by Wil Stewart on Unsplash

Let me know your comments below.

Stackademic 🎓

Thank you for reading until the end. Before you go:

--

--

Bernardo Iribarne
Nerd For Tech

Passionate about design patterns, frameworks and well practices. Becoming a Flutter expert