Flutter Version Management: A simple cli to manage Flutter SDK versions.
Features:
- Configure and use Flutter SDK version per project
- Ability to install and cache multiple Flutter SDK Versions
- Fast switch between Flutter channels & versions
- Dynamic SDK paths for IDE debugging support.
- Version FVM config with a project for consistency across teams and CI environments.
- Set global Flutter version across projects
This tool allows you to manage multiple channels and releases, and caches these versions locally, so you don't have to wait for a full setup every time you want to switch versions.
Also, it allows you to grab versions by a specific release, i.e. v1.2.0
or 1.17.0-dev.3.1
. In case you have projects in different Flutter SDK versions and do not want to upgrade.
To Install:
> pub global activate fvm
Read dart.dev docs for more info on how to run global dart scripts.
And then, for information on each command:
> fvm help
FVM gives you the ability to install many Flutter releases or channels.
version
- usestable
to install the Stable channel andv1.8.0
or1.17.0-dev.3.1
to install the release.--skip-setup
- will skip Flutter setup after install
> fvm install <version>
If you configured your project to use a specific version, run install
without any arguments will install the proper version.
> fvm install
Check out use
command to see how to configure a version per project.
You can use different Flutter SDK versions per project. To do that you have to go into the root of the project and:
> fvm use <version>
If you want to use a specific version by default in your machine, you can specify the flag --global
to the use
command. A symbolic link to the Flutter version will be created in the fvm
home folder, which you could then add to your PATH environment variable as follows: FVM_HOME/default/bin
. Use fvm use --help
, this will give you the exact path you need to configure.
Using the remove command will uninstall the SDK version locally, this will impact any projects that depend on that version of the SDK.
> fvm remove <version>
List all the versions that are installed on your machine. This command will also output where FVM stores the SDK versions.
> fvm list
Displays all Flutter releases, including the current version for dev
, beta
and stable
channels.
> fvm releases
There are some configurations that allows for added flexibility on FVM. If no cache-path
is set, the default fvm path will be used.
fvm config --cache-path <path-to-use>
Returns list of all stored options in the config file.
fvm config --ls
There are a couple of ways you can interact with the SDK setup in your project.
Flutter command within fvm
proxies all calls to the CLI just changing the SDK to be the local one.
> fvm flutter run
This will run flutter run
command using the local project SDK. If no FVM config is found in the project. FMV will recursively try for a version in a parent directory.
FVM creates a symbolic link within your project called fvm which links to the installed version of the SDK.
> .fvm/flutter/bin run
This will run flutter run
command using the local project SDK.
As an example calling fvm flutter run
is the equivalent of calling flutter run
using the local project SDK.
In some situations you might have to restart your IDE and the Flutter debugger to make sure it uses the new version.
Add the following to your settings.json. This will list list all Flutter SDKs installed when using VSCode when using Flutter: Change SDK
.
Use fvm list
to show you the path to the versions.
{
"dart.flutterSdkPaths": ["/Users/usr/fvm/versions"]
}
{
"dart.flutterSdkPaths": [".fvm/flutter_sdk"]
}
Copy the absolute path of fvm symbolic link in your root project directory. Example: /absolute/path-to-your-project/.fvm/flutter_sdk
In the Android Studio menu open Languages & Frameworks -> Flutter
or search for Flutter and change Flutter SDK path. Apply the changes. You now can Run and Debug with the selected versions of Flutter.
Add your IDE instructions here
pub run test
Before pushing package to pub.dev. Run command to create version constant.
pub run build_runner build
To update test coverage run the following command.
pub run test_coverage
This project is licensed under the MIT License - see the LICENSE file for details
Thanks goes to these wonderful people (emoji key):
Leo Farias π π€ π» π‘ π π§ π |
Ianko Leite π€ |
Caijinglong π» π€ |
zmtzawqlp π |
Peter Leibiger π» π§ |
David Martos π» |
Luca Panteghini π |
This project follows the all-contributors specification. Contributions of any kind welcome!