What is the difference between pubspec.yaml and pubspec.lock? Both are holding the dependencies versions.
The first time you get a new dependency for your package, pub downloads the latest version of it that’s compatible with your other dependencies. It then locks your package to always use that version by creating a lockfile. This is a file named pubspec.lock that pub creates and stores next to your pubspec. It lists the specific versions of each dependency (immediate and transitive) that your package uses.
~ source
In pubspec.yaml there are only packages and versions, which you need to use. In pubspec.lock there are also packages and versions which you need and which each of package that you use needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With