fvm
fvm copied to clipboard
Best practice for switching to a different Flutter version?
We want to use FVM in our team to ensure a consistent Flutter version across our team. From reading the docs, I can't find a good solution for switching to a new Flutter version.
We have committed the fvm_config.json
, but the flutter_sdk
is ignored by git (as described in the docs). What is now the process to switch to a new Flutter version? I would assume the following steps:
- Change the version in
fvm_config.json
- Run
fvm install
But now the problem: Every other developer needs to be notified, that their need to run fvm install
, otherwise they will use a different version, right?
I would love to hear of a better solution and add this to the FAQ section of the docs.
@nilsreichardt if a commit changes version there, I believe either they would need to be notified or could be part of an internal tool or process to do that. But again I am not sure how often this happens.
Maybe an implementation using git hooks might be what you need, here is a great article on it.
https://dev.to/arthurdenner/git-hooks-in-flutter-projects-with-lefthook-52n
FVM automatically asks you to install the new version if it was changes in the fvm_config.json
file.
There is no need to run fvm install
, any other command will ask you to install.
I found this to be working quiet well in a team, no need for any notification to update flutter.
For apps we additionally update the minimum flutter constraint in pubspec.yaml
but if every developer uses FVM, there is nothing to worry about.
You can also use the fvm_config.json
file to read and install the version in CI.
@kuhnroyal does this would apply if running the CLI but I believe if not running from the IDE tooling…
hmm yeah, if one only uses IDE, this is a problem.
I think a solution is to set also the flutter
version in the pubspec.yaml
:
environment:
sdk: '>=2.18.0 <3.0.0'
flutter: 3.3.2
Therefore, other people can't use unintentionally the old flutter version 👍
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.