Closed bartekpacia closed 1 year ago
Which version would you infer from >= 3.5.0 <4.0.0
?
I suggest you look at https://github.com/fluttertools/fvm and https://github.com/kuhnroyal/flutter-fvm-config-action if you want to manage the version in one place.
@kuhnroyal Thanks for showing https://github.com/kuhnroyal/flutter-fvm-config-action – looks nice and like something that is a way to solve this problem.
Which version would you infer from >= 3.5.0 <4.0.0?
The minimum one. It's a good practice to keep the lower bound of flutter
version constraint the same as the Flutter version you use. Try to set an upper bound on flutter
in a package's pubspec.yaml
and after running flutter pub publish --dry-run
you'll see:
Package validation found the following potential issue:
* The Flutter constraint should not have an upper bound.
In your pubspec.yaml the constraint is currently `>=3.3.0 <4.0.0`.
You can replace that with just the lower bound: `>=3.3.0`.
See https://dart.dev/go/flutter-upper-bound-deprecation
So for using current stable version of Flutter, it'd be:
environment:
sdk: '>=2.19.4 <4.0.0'
flutter: '>=3.7.7'
At work, when we upgrade a project to a newer Flutter version, we also update lower bound of flutter
in pubspec.yaml
, and I think it's a good practice.
I find it a bit annoying that whenever I update Flutter, I have to change the version in
pubspec.yaml
and in my GitHub Actions workflows.I think it'd be great if this action would infer Flutter version from
pubspec.yaml
:This approach is used in, for example, the actions/setup-go:
Of course, it'd still be possible to explicitly specify the Flutter version to use.