Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dart: How to determine which pub package is discontinued?

Tags:

flutter

dart

Dart: How to determine which pub package is discontinued?

I have a long list of packages. When I run dart pub upgrade it says that one is discontinued. Is there a command to list which one is discontinued?

like image 537
walkair Avatar asked Sep 25 '21 08:09

walkair


People also ask

What is pub outdated?

Outdated is one of the commands of the pub tool. $ dart pub outdated [options] Use dart pub outdated to identify out-of-date package dependencies and get advice on how to update them.

Where can I find Pubspec yaml?

Every Flutter project includes a pubspec. yaml file, often referred to as the pubspec. A basic pubspec is generated when you create a new Flutter project. It's located at the top of the project tree and contains metadata about the project that the Dart and Flutter tooling needs to know.

What does flutter pub upgrade do?

Without any additional arguments, dart pub upgrade gets the latest versions of all the dependencies listed in the pubspec. yaml file in the current working directory, as well as their transitive dependencies.

What to do when Dart pub is outdated?

Run dart pub outdated to identify which package dependencies are out-of-date. Note the affected packages, so that later you can test the behavior of code that uses them. Follow the recommendations of dart pub outdated for updating the packages.

Are Dart new and out-of-date packages mutually compatible?

Newer versions, while available, are not mutually compatible. To see why these packages are out-of-date, you can run dart pub deps and look for dependencies on these packages:

How do I find out the version of a dependency in Dart?

The output of dart pub outdated has four columns of version information for each out-of-date dependency. Here is the part of the example output that shows the four version columns: Current, Upgradable, Resolvable, and Latest. The version used in your package, as recorded in pubspec.lock .

How do I check if a package has a pubspec?

If your package doesn’t have a pubspec.lock file checked into source control, run dart pub get in the top directory of the package — the directory that contains your package’s pubspec.yaml file. Run dart pub outdated to identify which package dependencies are out-of-date.


1 Answers

Use the following combination of commands:

dart pub upgrade --dry-run | grep discontinued

In the resulting long list of packages from the dart pub upgrade command, I did not at first notice that "discontinued" is printed in parenthesis inline with the corresponding package. The above command combo will find those lines for you.

It's possible that the discontinued package is not in your direct pubspec packages, but buried deep in their dependencies. In my case, the "pedantic" package is discontinued, and that is still used by many other packages.

[EDIT]

In my original answer, I mixed up and put the incorrect command, which one of the comments references. "outdated" does not return discontinued. I corrected the command above. This was my original incorrect command.

dart pub outdated | grep discontinued

like image 119
walkair Avatar answered Oct 16 '22 13:10

walkair