-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The invalidation of pubspec.lock should be better documented on flutter.dev #144730
Comments
Similar issue here #119091 |
Thanks for the report. I was able to replicate the reported behavior as described in original post. Labeling this for tracking and for team's input / attention. stable, master flutter doctor -v
|
/cc @sigurdm |
I believe this is due to different flutter versions pinning different files: https://github.com/dart-lang/sdk/wiki/Flutter-Pinned-Packages This means that the
For production environements where you want to prevent this from happening you can use:
I think this documentation is imprecise, and should be updated. I didn't even know we had pub-specific documentation on flutter.dev - that seems to be overlapping with https://dart.dev/guides/packages#upgrading-a-dependency (which seems to have the same imprecision). |
I opened a separate issue for the documentation updates |
Thanks; updating the docs to mention "flutter version changes may change the lockfile for reasons X; |
Good question. We do have a message if a version resolution fails due to a pinned package. But in this case the version resolution doesn't really "fail" (from the solver's perspective) it merely finds a new resolution... Maybe there is a good way... It is not yet clear to me how we would do it anyways... |
flutter pub get
changes lockfile
Thanks, I am closing this in favor of dart-lang/pub#4164 |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to reproduce
Note that this was initially observed in a gitlab CI environment, then informally reproduced on Windows, and all the following is more painstakingly reproduced on Ubuntu 20.04.6 LTS, 64-bit.
(go to flutter sdk dir)
git checkout 3.16.5
flutter doctor
(go to your projects folder)
flutter create lockfile_bug_test
(copy in pubspec.yaml.txt ; remove .txt extension I added because github didn't want to attach a yaml)
git init
git add .
git commit -m "initial commit"
flutter pub get
git status
(observe pubspec.lock is created)
git add .
git commit -m "flutter pub get"
flutter channel stable
flutter upgrade
git status
(observe no change)
flutter pub get
(note "Changed 8 dependencies!")
git status
(note changed pubspec.lock)
Expected results
As per https://docs.flutter.dev/packages-and-plugins/using-packages , "Flutter saves the concrete package version found in the pubspec.lock lockfile. This ensures that you get the same version again if you, or another developer on your team, run flutter pub get." Therefore, when I
flutter pub get
, thenflutter upgrade
, thenflutter pub get
, the secondget
should get the dependencies listed in the lockfile, and not alter the lockfile.Actual results
When I
flutter pub get
, thenflutter upgrade
, thenflutter pub get
, the secondget
gets different dependencies than are listed in the lockfile, and alters the lockfile. (This caused an error in a CI pipeline we were running.)Code sample
Code not relevant, aside from the pubspec.yaml I linked in the instructions.
Screenshots or Video
No response
Logs
Logs
Flutter Doctor output
Doctor output
On new version:
and on old version:
The text was updated successfully, but these errors were encountered: