dart pub unpack
Unpack is one of the commands of the pub tool.
$ dart pub unpack <package>[:descriptor] [--[no-]resolve] [--output=<output directory>] [--[no-]force] [other options]
This command downloads the specified <package>
and
extracts its contents to a <package>-<version>
directory.
For example, the following command downloads and extracts the
latest stable version of package:http
from the pub.dev site,
to the current directory:
$ dart pub unpack http
To change the source or version of the downloaded package,
add a source descriptor after the package name and a colon.
For example, the following command downloads the 1.2.0
release
of package:http
from the pub.dev site:
$ dart pub unpack http:1.2.0
The source descriptor supports more configuration
with the same syntax as dart pub add
.
To learn more about source descriptors and their syntax, check out
the source descriptor documentation for dart pub add
.
Options
#For options that apply to all pub commands, check out Global options.
--force
or -f
#Overwrite existing folders that conflict with the package folder or its contents during extraction.
--[no-]resolve
#By default, dart pub get
runs automatically to complete
package resolution after downloading and unpacking a package.
To disable automatic resolution,
specify the --no-resolve
flag:
$ dart pub unpack http --no-resolve
--output=<dir>
or -o <dir>
#By default, extract the package to the current directory (.
).
To change the directory the package is extracted to,
specify the desired output directory with the --output
option.
For example, the following commands unpacks the
1.2.0
release of package:http
to the local_http_copies
directory.
$ dart pub unpack http:1.2.0 -o local_http_copies
除非另有说明,文档之所提及适用于 Dart 3.5.3 版本,本页面最后更新时间: 2024-05-21。 查看文档源码 或者 报告页面问题。