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?
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.
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.
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.
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.
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:
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 .
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.
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
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