Open cassioso opened 11 months ago
Which version would you derive from your constraint and why? 3.16.2 on stable? What if 3.16.0 is already installed? What if I have 3.16.2 on beta installed?
On this date I would expect flutter: ">=3.16.0"
to be resolved to 3.16.2
because this is the latest available version satisfying the specified condition. Using the stable channel because no other channel was mentioned (if I have a version with the .pre
prefix in use then I would expect the installation command to also consider beta channel updates).
Also because we are talking about the command fvm install
, so a new installation is not an unexpected outcome. Maybe if the command in question was fvm use ">=3.16.0"
and I have 3.16.0 already installed then I would expect it to be used instead of having a new installation.
What do you all think about it pulling the exact version from the pubspec.lock
file if it's available?
Example
...
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.19.1"
FVM 3 does constraints checking for dart; we can do the same for flutter sdk, but using the constraints to determine the version might not be ideal
I'd like to see this as well - my current understanding is that, if other tools/processes read from pubspec.yaml
, there's a manual step involved in keeping the Flutter version in pubspec.yaml
synced with .fvmrc
(or vice versa) when changing versions (e.g. with fvm use {version}
). That feels inconvenient and error prone. I might be missing something though.
Is your feature request related to a problem? Please describe. It is a bit redundant to have to define a config file or run an extra command to specify which flutter version should be installed when this information is already specified in pubspec.yaml.
Describe the solution you'd like
fvm install - # Installs version found in project config
should have the option to use the specified flutter version already defined inpubspec.yaml
underenvironment:
>flutter:
.Describe alternatives you've considered Installing yq and run
fvm install `yq -r .environment.flutter pubspec.yaml`
. Not ideal especially if the flutter version is set asflutter: ">=3.16.0"
or similar.Additional context Looks like this feature was considered in the past: https://github.com/leoafarias/fvm/blob/161c0834c8d91f437087e27623b7a95288912792/lib/src/services/project_service.dart#L45C1-L47C1