0

When I have to use a package, I'm going to pub.dev and look for it.

pub.dev

Once I got it, I click on the installing tab.

Installing

Then I got the package's latest version and I add it to the pubspec.yaml

pubspec.yaml

I've seen plenty of times another way of adding a package to the pubspect.yaml:

another way

I wonder if this way also refers to the package's latest version.

Thanks in advance !!

DBG
  • 1
  • 1
  • [Please post code/errors/etc as formatted text instead of links to images of formatted text.](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question/285557#285557) – Dave Newton Feb 28 '23 at 17:00

1 Answers1

0

It does not mean the latest version. It means 'any' version. The good way to check installed version is to look into pubspec.lock file, it contains locked information about installed dependencies, their checksums etc.

For example, I have got installed path_provider package with version 2.0.12 in my project. It is not in pubspec.yaml, but it is required by other package in pubspec.lock. So, after adding path_provider: to pubspec.yaml its version is still the same - 2.0.12 and not latest (2.0.13). That's because 'any' version is satisfied by 2.0.12.