deprecated_ new_ in_ comment_ reference
Details about the 'deprecated_new_in_comment_reference' diagnostic produced by the Dart analyzer.
Using the 'new' keyword in a comment reference is deprecated.
Description
#
The analyzer produces this diagnostic when a comment reference
(the name of a declaration enclosed in square brackets in a
documentation comment) uses the keyword new to
refer to a constructor. This form is deprecated.
Examples
#
The following code produces this diagnostic because the
unnamed constructor is being referenced using
new C:
/// See [new C].
class C {
C();
}
The following code produces this diagnostic because the
constructor named
c is being referenced using new C.c:
/// See [new C.c].
class C {
C.c();
}
Common fixes
#
If you're referencing a named constructor, then remove the
keyword new:
/// See [C.c].
class C {
C.c();
}
If you're referencing the unnamed constructor, then remove the
keyword
new and append .new after the class
name:
/// See [C.new].
class C {
C.c();
}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.