Outdated is one of the commands of the pub tool.
$ pub outdated [options]
pub outdated to identify out-of-date package dependencies
and get advice on how to update them.
Best practices for dependency management
include using the most recent stable package versions,
so you can get the latest bug fixes and improvements.
Here’s how you can use
pub outdated to help you
update the dependencies of a package that you own
(whether it’s an app or library package):
- If your package doesn’t have a
pubspec.lockfile checked into source control, run
pub getin the top directory of the package — the directory that contains your package’s
pub outdatedto 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
pub outdatedfor updating the packages. Some updates might require only running
pub upgrade. Others might require updating
pub outdatedto confirm that you’re using the latest compatible package versions.
- Test your package to confirm that it still works as expected.
You might still have out-of-date dependencies due to
If you want to determine the cause,
pub deps and searching the output for
the name of each out-of-date package.
Here’s an example of running
pub outdated on
an example that has several out-of-date dependencies.
Three of the dependencies (
path) are direct,
and one is transitive (
As the following example shows,
pub outdated colorizes the output by default
when you run it on the command line.
$ pub outdated Dependencies Current Upgradable Resolvable Latest args 1.4.4 1.6.0 1.6.0 1.6.0 http 0.11.3+17 0.11.3+17 0.12.1 0.12.1 path 1.6.2 1.6.2 1.6.2 1.7.0 dev_dependencies: all up-to-date transitive dependencies meta 1.1.6 1.1.6 1.1.6 1.1.8 transitive dev_dependencies: all up-to-date 1 upgradable dependency is locked (in pubspec.lock) to an older version. To update it, use `pub upgrade`. 1 dependency is constrained to a version that is older than a resolvable version. To update it, edit pubspec.yaml.
The Resolvable column shows which versions you can upgrade to
for each out-of-date dependency.
You can get more information by looking for
the leftmost column with a non-red value.
args is upgradable to 1.6.0,
http is resolvable to 0.12.1.
meta packages aren’t the latest versions,
but are the most current resolvable versions,
considering all the other dependencies.
To fix the first dependency (
which is listed as upgradable,
you just need to run
$ pub upgrade Resolving dependencies... > args 1.6.0 (was 1.4.4) ... Changed 1 dependency!
To fix the second dependency (
which is listed as resolvable,
you can change the pubspec’s
http entry to use
the version in the Resolvable column
(or a compatible higher version).
In caret syntax, that’s
Here’s the diff for
- http: ^0.11.0 + http: ^0.12.1
pubspec.yaml, you run
pub upgrade to
You can then run
pub outdated to confirm that
you’ve made all necessary changes.
In this example, the
meta packages are still out-of-date,
due to reasons that this package doesn’t control:
$ pub upgrade ... $ pub outdated Dependencies Current Upgradable Resolvable Latest path 1.6.2 1.6.2 1.6.2 1.7.0 dev_dependencies: all up-to-date transitive dependencies meta 1.1.6 1.1.6 1.1.6 1.1.8 transitive dev_dependencies: all up-to-date Dependencies are all on the latest resolvable versions. Newer versions, while available, are not mutually compatible.
To see why these packages are out-of-date, you can run
and look for dependencies on these packages:
$ pub deps -s list ... dependencies: ... - terminal_tools 0.1.0 - path 1.6.2 - meta 1.1.6 ...
As the preceding output shows,
this package depends on the
which depends on old versions of
terminal_tools package is updated,
it should be possible to update this package.
The output of
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.
Dependencies Current Upgradable Resolvable Latest args 1.4.4 1.6.0 1.6.0 1.6.0 http 0.11.3+17 0.11.3+17 0.12.1 0.12.1 path 1.6.2 1.6.2 1.6.2 1.7.0 dev_dependencies: all up-to-date transitive dependencies meta 1.1.6 1.1.6 1.1.6 1.1.8
- The version used in your package, as recorded in
pubspec.lock. If the package isn’t in
pubspec.lock, the value is
- The latest version allowed by your
pubspec.yamlfile. This is the version that
pub upgraderesolves to. The value is
-if the value in the Current column is
- The latest version that can be resolved,
when combined with all other dependencies.
This version corresponds to what
pub upgradegives you if all version constraints in
pubspec.yamlare unbounded. A value of
-means that the package won’t be needed.
- The latest version of the package available,
excluding prereleases unless you use the option
For example, say your app depends on the
but the latest version of
bar allows only older major versions of
The result is that the latest resolvable version of
is different from the latest version of
When you edit the
you generally update the dependencies and dev_dependencies sections
so that each package uses the versions in the Resolvable column.
For options that apply to all pub commands, see Global options.
- Use this option to generate output in JSON format.
- Use this option to change whether the output uses color for emphasis.
The default depends on whether you’re using this command at a terminal.
At a terminal,
--coloris the default; otherwise,
--no-coloris the default.
--up-to-dateto make the output include dependencies that are already at the latest version. The default is
--no-up-to-date, which saves space.
--prereleasesto include prereleases when determining the latest package versions. By default, prerelease versions aren’t considered.
--no-dev-dependenciesto ignore dev dependencies.
dependency_overrideswhen resolving package constraints.