Use dartdocgen to generate, and serve, the documentation for your Dart package.
Dartdocgen generates documentation from Dart code in the
and creates the output in JSON format.
When using the
--serve option, dartdocgen serves your files so you can
see them locally in a browser.
To deploy your documentation to the web,
along with your generated files.
Here is a simple example of using dartdocgen to generate docs
on the command line. The docs are generated from the source
code in the
Run this command from the top-level directory of your Dart package,
after you have run
pub get to get the dependencies:
This command generates documentation, in the JSON
file format, and places it in a top-level directory named
See options for information on how to configure
Here is a simple example of using dartdocgen to generate, and then serve, the generated docs to the viewer.
dartdocgen --serve .
After generating the documentation,
this command puts
dartdoc-viewer in a top-level directory
(if not already present), and starts it up.
The generated docs can now be viewed in your browser at
To deploy your documentation to the web, do the following:
docsunder the main URL.
Common command-line options for dartdocgen include:
<directory>. If not specified, the default is
Some other handy options include:
_). For more information on private identifiers, see Important Concepts in the Dart language tour.
--servefor faster start-up.
Dartdocgen includes a number of options that apply only to generating
the Dart SDK documentation. Those are not documented here, but
you can obtain a list by using the
dartdocgen -h command.