Make sure you run dart pub get or dart pub upgrade in your target project directory.
Here's an example of pubviz run on itself.
Activate pubviz.
$ dart pub global activate pubvizIf you have configured your PATH correctly, you can run pubviz
directly.
$ pubvizOtherwise, you can use the pub global command.
$ dart pub global run pubviz$ pubvizWill open the default browser to something like:
$ pubviz -a print /path/to/http_packageYou should see output something like:
digraph G {
node [fontname=Helvetica];
edge [fontname=Helvetica, fontcolor=gray];
http [label="http
1.2.0",fontsize=18,style=bold,shape=box,margin="0.25,0.15"];
http -> async [label="^2.5.0",penwidth=2];
http -> http_parser [label="^4.0.0",penwidth=2];
http -> path [label="^1.8.0",penwidth=2];
async [label="async
2.11.0",shape=box,margin="0.25,0.15",style=bold];
async -> collection [label="^1.15.0"];
collection [label="collection
1.18.0",shape=box,margin="0.25,0.15",style=bold];
http_parser [label="http_parser
4.0.2",shape=box,margin="0.25,0.15",style=bold];
http_parser -> collection [label="^1.15.0",color=gray];
http_parser -> source_span [label="^1.8.0",color=gray];
path [label="path
1.9.0",shape=box,margin="0.25,0.15",style=bold];
}GraphViz tool allows dot format to be converted to various types of outputs like PNG, PDF or SVG.
In order to export pubviz data to PNG file you need to install GraphViz package on your machine (see detailed installation instructions).
On macOS:
brew install graphvizOn Windows:
winget install graphvizThen you can save the pubviz output to a file and convert it with dot
command to desired output type, e.g.:
pubviz -a print > output.dot
dot -Tpdf output.dot -o output.pdfThe full list of possible output types is available on the GraphViz website.
$ pubviz -?
Usage: pubviz [<args>] [<package path>]
Arguments:
-a, --action=<action>
[open] (default) Like "serve" but also opens the browser.
[print] Print the raw DOT output to stdout.
[serve] Hosts the web app on a local server.
-i, --ignore-packages A comma separated list of packages to exclude in the output.
-o, --[no-]flag-outdated Check pub.dev for latest packages and flag those that are outdated.
(defaults to on)
-d, --direct-dependencies Include only direct dependencies.
-p, --production-dependencies Include only production (non-dev) dependencies.
-v, --version Print the version of pubviz and exit.
-w, --[no-]workspace Include all packages in the workspace.
-?, --help Print this help content.
If <package path> is omitted, the current directory is used.