-
Notifications
You must be signed in to change notification settings - Fork 124
Document @docImport
in README.md
#3935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,6 +288,24 @@ dartdoc is currently documenting. This can lead to inconsistent behavior betwee | |
packages, especially if different command lines are used for dartdoc. It is recommended to use collision-resistant | ||
naming for any macros by including the package name and/or library it is defined in within the name. | ||
|
||
### 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: | ||
|
||
```dart | ||
/// @docImport 'dart:async'; | ||
/// @docImport 'package:flutter/element.dart' show Element; | ||
/// @docImport '../path/to/somwhere.dart'; | ||
/// @docImport 'dart:html' as 'html'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'as' is not supported. (yet?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. Noting we have an issue for it dart-lang/sdk#56527 and the umbrella issue for it does mention this was a goal dart-lang/sdk#56186. |
||
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 {} | ||
``` | ||
|
||
### Tools | ||
|
||
Dartdoc allows you to filter parts of the documentation through an external tool | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'show' is not supported. (yet?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. Noting the umbrella issue for it does mention this was a goal dart-lang/sdk#56186.