dart install
Install Dart CLI tools for global use.
The dart install command installs Dart CLI
tools for global use. It is a newer alternative to
dart pub global activate.
Install a package
#There are a few ways to install a package. To learn more, see the following sections.
Install a general package
#
The following command installs all executables specified in
a package's pubspec.yaml
executables
section on the PATH.
dart install [arguments] <package> [version-constraint]
For example:
dart install markdown
Install a pub.dev package
#The following command specifies a package on the pub.dev site to install.
dart install <pub.dev package>
For example:
dart install markdown
Install a Git package
#The following commands can both be used to install a package in a Git repository.
dart install <Git URL>
The following example installs the
async_await package from
GitHub:
dart install https://github.com/dart-lang/async_await.git
Pub expects to find the package in the root of the Git
repository. To specify a different location, use the
--git-path option with a path relative to the
repository root:
dart install \
https://github.com/dart-lang/http.git \
--git-path pkgs/http/
Pub uses the default branch of the Git repository. To
specify a different branch or commit, use the
--git-ref option:
dart install \
https://github.com/dart-lang/http.git \
--git-ref 36f98e900347335af2338a0e087538009b7de2f9
Command reference
#The following commands are useful for installing, uninstalling, and checking the install state of a Dart CLI tool.
dart install
#Installs a package for Dart.
dart install [arguments] <package> [version-constraint]
| Arguments | Description |
|---|---|
--git-path
|
Path of the git package within the repository. This
only applies when using a git URL for
<package>
.
|
--git-ref
|
The specific git branch or commit to retrieve. This
only applies when using a git URL for
<package>
.
|
--overwrite
|
Allows overwriting executables from other packages that have the same name. |
-u, --hosted-url
|
A custom pub server URL for the package. This only
applies when using a package name for
<package>
.
|
In the following example, the markdown package is installed with no arguments or version constraints:
dart install markdown
dart uninstall
#Uninstall a package for Dart.
dart uninstall <package>
For example:
dart uninstall markdown
dart installed
#Check which packages are installed
dart installed
Options for the dart install command
#
These options can be use for the
dart install command. For options that apply to
all pub commands, see
Global options.
-h, --help
#
Use the -h or --help option to get
help for a specific command. For example, the following
commands produce an overview and list of arguments available
to dart install:
dart install --help
dart install -h
--git-path
#
Use the --git-path option to specify the path
of the package in the Git repository.
dart install --git-path <path>
For example:
dart install --git-path https://github.com/dart-lang/async_await.git
--git-ref
#
Use the --git-ref option to specify the Git
branch or commit to be retrieved.
dart install --git-ref <ref>
For example:
dart install --git-ref tmpfixes
--overwrite
#
Use the --overwrite option to overwrite any
previously installed global executables with the same name.
If you don't specify this flag, the preexisting executable
will not be replaced.
dart install <package> --overwrite
For example:
dart install markdown --overwrite
--hosted-url
#
Use the --hosted-url option to specify a custom
pub server URL for the package. This only applies when using
a package name for <package>.
dart install --hosted-url <url>
For example:
dart install --hosted-url https://dart-packages.example.com/
[version-constraint]
#
Use the version-constraint option to specify a
specific version of the package.
dart install <package> [version-constraint]
For example, the following command pulls the 0.6.0 version
of the markdown package:
dart install markdown 0.6.0
If you specify a range, pub picks the best version that meets that constraint. For example:
dart install foo <3.0.0