Skip to main content

mkdocstrings-dart

License

A Dart handler for mkdocstrings, bringing beautiful, automatic API documentation to Dart packages in MkDocs.

Powered by dartdoc_json, it extracts doc comments, signatures, parameters, return types, and source code from your Dart libraries — no extra configuration needed.

Features

  • Renders classes, constructors, methods, getters/setters
  • Parameter tables with names, types, and defaults
    (Parameter descriptions appear in the main method docstring)
  • Return type display
  • Collapsible source code with Dart syntax highlighting
  • Auto-detects your package name from pubspec.yaml
  • Supports both ::: package.Class and ::: Class identifiers
  • Respects paths, exclude_files, and show_source options
  • Modern, wide, responsive styling

Installation

pip install mkdocstrings-dart
dart pub global activate dartdoc_json

Note: dartdoc_json is required to parse Dart source. It's lightweight and uses the official Dart analyzer.

Usage

Note: When using mkdocstrings-dart alongside other handlers (e.g., the default Python handler), you must explicitly set the default handler if you want Dart to be used for unmarked ::: blocks, otherwise define the handler with each block definition.

In your mkdocs.yml:

plugins:
  - mkdocstrings:
      default_handler: dart   # <- Required if you want ::: Identifier to use Dart by default
      handlers:
        dart:
          options:
            paths: ["lib"]                # Default: ["lib"]
            show_source: true             # Show collapsible source code
            exclude_files: ["curo.dart"]  # Optional: skip barrel files

Options

Option Type Default Description
paths list[str] ["lib"] Directories to scan for .dart files
show_source bool true Show source code in a collapsible panel
exclude_files list[str] [] Basenames of files to skip (e.g., barrel files)
heading_level int 2 Starting heading level for rendered docs

Then in your Markdown files:

# Calculator API

::: <package-name>.Calculator
# or simply
::: Calculator

Rendered Example

Below is exactly how the above ::: Calculator markdown will appear in your final HTML documentation site:

Screenshot of rendered Dart docs using the included example

Development

# Editable install
pip install -e .
dart pub global activate dartdoc_json
mkdocs serve

Roadmap

  • Support for library-level overviews
  • Cross-references between classes
  • Better handling of generics and annotations
  • Material for MkDocs theme integration tweaks

Credits

Built with inspiration from the official mkdocstrings Python handler and powered by the excellent dartdoc_json tool.

Made with ❤️ for the Dart community.

Metadata

Release files for mkdocstrings-dart 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdocstrings-dart 0.1.1
File Size Uploaded
mkdocstrings_dart-0.1.1.tar.gz 328.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocstrings-dart 0.1.1
File Interpreter ABI Platform
mkdocstrings_dart-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 340.0 kB

Release files / mkdocstrings_dart-0.1.1.tar.gz

Download URL mkdocstrings_dart-0.1.1.tar.gz
Size 328.6 kB
Tags Source
SHA-256 checksum
How to use checksums
691a0b42b32ffedc2d75b09eaa2398b4077895a46614435f41d723042cef9c92
BLAKE2b-256 checksum
How to use checksums
721e9ab6c3a08ca2ce6b6e84f999ff004b3cfc9d4c79e875bd570de28b091195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / mkdocstrings_dart-0.1.1-py3-none-any.whl

Download URL mkdocstrings_dart-0.1.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75b71d40e526091bd14f64fe3ef60fa49b8c76ae5a02d43a9d0dfcac812f1e47
BLAKE2b-256 checksum
How to use checksums
d7027b12649ca449889deba5e8e684874f7fb4d91060fd2a69075e1558fface1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page