dartdoc to generate HTML documentaton for your Dart package.
Note: As of Dart 1.12,
dartdoc is shipped with the Dart SDK and replaces the
If you want to contribute to the dartdoc project, see the contributor docs. This page contains information about using the dartdoc tool.
Download the Dart SDK, version
1.12-dev.5.10 or later. If not already added, add the SDK's
bin directory to
You can install the latest version of dartdoc with
$ pub global activate dartdoc
Note: to ensure that this version is run when you type
dartdoc on the command
line, make sure that
~/.pub-cache/bin is on your
PATH, and before the path
to the Dart SDK.
dartdoc from the root directory of package. For example:
$ dartdoc Generating documentation for 'server_code_lab' into <path-to-server-code-lab>/server_code_lab/doc/api/ parsing lib/client/piratesapi.dart... parsing lib/common/messages.dart... parsing lib/common/utils.dart... parsing lib/server/piratesapi.dart... Parsed 4 files in 8.1 seconds. generating docs for library pirate.messages from messages.dart... generating docs for library pirate.server from piratesapi.dart... generating docs for library pirate.utils from utils.dart... generating docs for library server_code_lab.piratesApi.client from piratesapi.dart... Documented 4 libraries in 9.6 seconds. Success! Docs generated into <path-to-server-code-lab>/server_code_lab/doc/api/index.html
By default, the documentation is generated to the
doc/api directory as static
You can view the generated docs directly from the file system, but if you want to use the search function, you must load them with an HTTP server.
An easy way to run an HTTP server locally is to use the
dhttpd package. For
$ pub global activate dhttpd $ dhttpd --path doc/api
http://localhost:8080 in your browser; the search function should
dartdoc produces static files with a predictable link structure.
index.html # homepage index.json # machine-readable index library-name/ # : is turned into a - e.g. dart:core => dart-core ClassName-class.html # "homepage" for a class (and enum) ClassName/ ClassName.html # constructor ClassName.namedConstructor.html # named constructor method.html property.html CONSTANT.html property.html top-level-function.html
File names are case-sensitive.
Command-line options for dartdoc include:
--header=<file>Insert the specified file, which contains HTML code, into the footer of every page.
--footer=<file>Insert the specifying file, which contains HTML code, into the header of every page.
--input=<directory>Generate the docs from the specified directory. If not specified, it defaults to the current directory.
--output=<directory>Generate the output to the specified directory. If not specified, it defaults to
--package-root=<directory>Specify the package root of the library.
--exclude=<lib1,lib2,lib3,...>Exclude the specified libraries from the generated docs.
--include=<lib1,lib2,lib3,...>Generate docs for the specified libraries.
--hosted-url=<url>Build a docs sitemap using the specified URL for your website.
--add-crossdartAdd links to Crossdart to the Source Code sections.
The following options are used only when generating docs for the Dart SDK.
--dart-sdk=<path>Specify the location of the Dart SDK, if it can't be detected automatically.
--sdk-docsGenerate only docs for the Dart SDK.
--sdk-readme=<file>Specify the README file for the Dart SDK.
Please file reports on the GitHub Issue Tracker.
Please see the dartdoc license.
spanin accessor setter template
--package-rootoption. Dartdoc now uses the
--inputflag as the place to start looking for an analysis root. This better supports the
.packagesfile and use cases where dartdoc is invoked from locations other than the project directory.
You can install the package from the command line:
$ pub global activate dartdoc
The package has the following executables:
Add this to your package's pubspec.yaml file:
dependencies: dartdoc: ^0.7.3
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.28.3+2||Apr 16, 2019|
|0.28.3+1||Apr 5, 2019|
|0.28.3||Apr 3, 2019|
|0.28.2||Feb 14, 2019|
|0.28.1+2||Feb 5, 2019|
|0.28.1+1||Feb 4, 2019|
|0.28.1||Feb 4, 2019|
|0.28.0||Jan 14, 2019|
|0.27.0||Jan 3, 2019|
|0.26.1||Dec 13, 2018|