In Flutter, FVM is the primary Flutter version management tool. But what should we do when the monorepo or any other language project is involved? Should we use proper tools respectively?
I recommend using mise in that case.
Here, I focus on introducing how to use mise in FVM project. If you can start the Flutter project with mise, you do not need FVM. You can run the mise use command or add the mise config file and run mise i as well.
Before we get to the main points, describe this tool briefly.
What is mise?
According to the official document, mise, formerly called rtx, is a development environment setup tool, and one of its functionality is this:
mise installs and manages dev tools/runtimes like node, python, or terraform both simplifying installing these tools and allowing you to specify which version of these tools to use in different projects. mise supports hundreds of dev tools.
In short, mise is suitable for people who use various languages and projects with multiple components like front-end, back-end, or something.
If you would like more information, check out the official site!
# Show all installable versions
asdf list-all flutter
# Install specific version
asdf install flutter latest
# Set a version globally (on your ~/.tool-versions file)
asdf global flutter latest
# Now flutter commands are available
flutter --help
Check asdf readme for more instructions on how to
install & manage versions.
Support fvm
If you have set legacy_version_file = yes in $HOME/.asdfrc, you can read the Flutter version from .fvmrc or .fvm/fvm_config.json, the fvm configuration file.
Troubleshooting
VS Code
To fix the "Could not find a Flutter SDK" error, you can set the FLUTTER_ROOT environment variable in your .bashrc or .zshrc file: