Deleted pubspec.lock regenerates with newer package versions?
A coworker clued me in. Deleting and regenerating the pubspec.lock
file performs a pub upgrade
, which is why the packages are newer. Doing a pub get
does not run pub upgrade
.
buttonsrtoys
Updated on January 03, 2023Comments
-
buttonsrtoys over 1 year
To repair our
pubspec.lock
file during development, I occasionally delete it and runflutter pub get
to regenerate it.What I'm seeing now is, I run
flutter pub get
and no changes are made to thepubspec.lock
file. But, when I deletepubspec.lock
and runflutter pub get
, git shows that several updates to our packages in the regeneratedpubspec.lock
file compared to the one that was deleted.We're all on flutter 2.8. I've tested this with 2.8.0 and 2.8.1 and there are slight differences between the two, but they both update a dozen or more packages. Most updates are patches but a few are minor updates.
Could be something fundamental I'm not understanding about
pubspec.lock
files? If we're all on the same version of flutter, shouldn't deleting/rebuildingpubspec.lock
produce an identical file?