Description
A specific case for #1663: The Effective Dart guidelines claim:
The dot syntax can also be used to refer to named constructors. For the unnamed constructor, put parentheses after the class name:
/// To create a point, call [Point()] or use [Point.polar()] to ...
I just tested this with dartdoc 0.24.1 from the Dart 2.1 SDK, and the unnamed constructor reference doesn't seem to work; it links to the class instead.
https://github.com/dart-lang/dartdoc/wiki/dartdoc-comment-references instead says to use [MyClass.MyClass]
to reference the unnamed constructor. That does work, but the generated documentation literally has MyClass.MyClass
, which looks weird since that's not what anybody uses in code. Can we do one (or both) of:
- Make
[MyClass()]
refer to the unnamed constructor as claimed by Effective Dart? (Or, less desirably, fix the false claim by Effective Dart.) - Make
[MyClass.MyClass]
show up asMyClass
(orMyClass()
) in the generated documentation?
?
The motivation for this was my attempt at removing lingering new
usage in Flutter API documentation, which was used to disambiguate references to classes from references to constructors (flutter/flutter#24625).