leoafarias / fvm

Flutter Version Management: A simple CLI to manage Flutter SDK versions.
https://fvm.app
MIT License
4.7k stars 229 forks source link

[Feature Request] FVM should automatically switch used Flutter version on git checkout #764

Open rasmk opened 2 months ago

rasmk commented 2 months ago

Is your feature request related to a problem? Please describe. I believe FVM is a perfect solution to have multiple versions of Flutter in the project. I.e. the git branch(es) for the ongoing development use the most recent Flutter version. At the same time we have maintenance branches, in which we provide bug-fixes for the already released versions. The maintenance branches should keep their dependencies 'frozen' and always use Flutter version with which they were released. At least until we decide to upgrade Flutter to the latest bugfixing version, or so.

The git-managed .fvmrc and .vscode/settings.json are already getting into this direction. Whenever I checkout a maintenance branch, they are updated accordingly and use the version I need.

Unfortunately, the gitignored .fvm folder is not updated and causes inconsistency. And error message The SDK configured in dart.flutterSdkPath is not a valid SDK folder. in VS Code. Then it gets somewhat tricky to bring it to consistency with fvm use.

Describe the solution you'd like I would like the Flutter version to always match the one in .fvmrc. And auto-switch whenever it is updated.

For this, I beliieve the following is needed:

I do not know what _.fvm/fluttersdk link is for. If this is really necessary, and could not be removed, perhaps it could be linked to the version link in versions subfolder. This would make it relative. Then it could be git-managed and updated accordingly on checkout. The other files (release, version, fvm_config.json) seem excessive to me. I could add them to git though, if they cannot be removed.

So two critical changes to make the behavior happen are: