Cache is one of the commands of the pub tool.
$ dart pub cache add <package> [--version <constraint>] [--all]
$ dart pub cache repair
The dart pub cache
command works with the
system cache.
To add new packages to your cache, use dart pub cache add
.
To perform a clean reinstall of the packages in your system cache,
use dart pub cache repair
.
Options
For options that apply to all pub commands, see Global options.
add <package>
- Installs a library in your cache.
--all
- Optional. Use with
dart pub cache add
to install all matching versions of a library. --version <constraint>
- Optional. Use with
dart pub cache add
to install the best version matching the specified constraint. For example:
If$ dart pub cache add http --version "0.12.2"
--version
is omitted, pub installs the best of all known versions. repair
- It's possible for packages in your pub cache to change or break.
For example, some editors make it easy to find implementation files for
packages in the pub cache, and you might accidentally edit one of those files.
The
dart pub cache repair
command performs a clean reinstall of all hosted and git packages in the system cache.