I use Flutter with FVM, and I stumbled upon an issue: how can I upgrade an old project to the same SDK version I'm currently using?
As an example, I have some Flutter versions I can switch using FVM, and wanted to upgrade a project to use the 3.7.0 version of the framework. I fear that doing that by using "flutter upgrade" could upgrade the SDK inside the 3.7.0 folder to the lastest version. I just wanted to bring this project to the 3.7.0 version, or whichever active version I switch to with FVM.
I noticed the pubspec.lock file have a line like 'flutter: ">=3.3.0"' at the sdk section, not sure if I should edit that line, once that file shouldn't be edited under normal circunstances.
Only noticed the pubspec.lock file but not sure if I shoud change it. I read another answers saying to use 'flutter upgrade' in the project folder, but I fear to be ending up to upgrading the SDK too, as I'm using FVM, I just add a SDK version to my system, and never update the SDK like this, because each version is stored on it's own folder.
According to the flutter pubspec docs the pubspec.lock
file is automatically generated, thus I assume it changes if you adapt your pubspec.yaml
file and then run fvm flutter pub get
.
If you already use FVM, you could also use Sidekick, it is from the same author and integrates with FVM as far as I can tell... I've been using FVM and Sidekick for the same reason since I needed to update an old flutter project and it offers a lot of nice-to-have features which abstracted away some of the things I wasn't sure about. For example it allows you to quickly see which flutter versions are installed via FVM and you can simply select the one you want to use in your project.