Description
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 {}