In large commercial projects or for indie developers who have numerous apps already developed, the biggest problem is always managing multiple versions of Flutter for all these projects. It is normal for frameworks to evolve, and with this, problems occur. We don't always have the time to migrate all projects to the latest version, or we have dependencies that need more time to be adapted to the latest version. This is where the solution provided by FVM, developed by Leo Farias, comes into play. FVM allows for the management of multiple Flutter installations and the ability to switch between them easily through a practical CLI.
What is FVM?
FVM is an open-source tool designed to make Flutter version management easier. It allows developers to install, manage, and switch between different Flutter versions seamlessly. Whether you are working on multiple projects that require different versions of Flutter or collaborating with a team, FVM ensures consistency and reduces the overhead of version conflicts.
Key Features of FVM
- Version Isolation: Keep project dependencies isolated by specifying a Flutter version for each project.
- Team Collaboration: Ensure all team members use the same Flutter version, avoiding "it works on my machine" issues.
- Easy Version Switching: Quickly switch between Flutter versions without the hassle of manually downloading and configuring them.
- Global and Local Versions: Set global Flutter versions for all projects or override them with specific local versions per project.
- Fast Setup: Install and set up specific Flutter versions quickly using simple commands.
Instalation
The installation steps are for operating systems, but it is available on the most common tools on each platform. It can be installed as a Flutter dependency, but this is the least recommended option since we want FVM to be an independent operating system tool for managing versions.
macOS
brew tap leoafarias/fvm
brew install fvm
Windows
choco install fvm
Linux
curl -fsSL https://fvm.app/install.sh | bash
Dart
dart pub global activate fvm
The project already has documentation on how to integrate management with the two main IDEs used, Android Studio (IntelliJ) and VS Code. It detects and indicates what needs to be configured in the project through a command:
fvm doctor
Effortless Version Switching
Switching between Flutter versions is hassle-free with FVM. Whether you’re testing a new Flutter release or maintaining an older project, FVM allows you to switch versions with a single command.
fvm install 3.19.2
fvm use 3.19.2
This command sets Flutter version 3.19.2 for your current project, ensuring everyone on your team is using the same version. That's the config .fvmrc
file generate inside the project folder.
{
"flutter": "3.19.2"
}
This sets the global Flutter version to 3.22.0, which will be used across all your projects unless overridden locally.
fvm global 3.22.0
For teams
In the case of teams, it is always interesting to have a way to ensure that everyone on the team knows the correct library version required for the project. Once the local version is within the project directory, it can be easily configured with just one command.
fvm install -s
Beta
Another case is to check if the application continues to exhibit the same behavior in the beta version of the library. Mobile applications, in particular, benefit greatly from always using the latest version, which typically brings improvements that can help enhance their performance in app stores.
fvm install beta -s
Conclusion
As the Flutter development environment grows and becomes a productivity tool for developers, it is normal for the ecosystem tools that allow us to manage and maintain high performance in projects to grow as well. FVM is a very interesting tool that every Flutter developer should keep an eye on.
Top comments (0)