Skip to content

Document analyzer-supported documentation imports #6140

@parlough

Description

@parlough

Topic

https://dart.dev/tools/doc-comments/references

Notes

Add Documentation imports section to Documentation comment references guide.

Feature reference: dart-lang/sdk#56186

Follow up to #6080.

\cc @srawlins CCing you so you can follow this issue. If you do end up wanting to work on these docs, feel free to assign yourself. Thanks for your work on the initial docs and this feature!!

Content from https://github.com/dart-lang/dartdoc/pull/3935/files

Documentation imports (/// @docImport)

Libraries that are only referenced in documentation comments ([Future]) can be imported with a
/// @docImport '<uri>' comment on the library element, like:

/// @docImport 'dart:async';
/// @docImport 'package:flutter/element.dart' show Element;
/// @docImport '../path/to/somwhere.dart';
/// @docImport 'dart:html' as 'html';
library;
/// We can now reference [Future] from dart:async, [Element] from Flutter's element library,
/// and [html.Element] from dart:html, even if none of these libraries are actually imported
/// by this library.
class Foo {}

Metadata

Metadata

Assignees

Labels

d.enhancementImproves docs with specific aske2-daysCan complete in < 5 days of normal, not dedicated, workp.referencesp2-mediumNecessary but not urgent concern. Resolve when possible.t.cli-toolsRelates to the dart command line toolst.diagnosticsRelates to diagnostics, analysis, or linting of code

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions