no_annotation_constructor_arguments
Annotation creation must have arguments.
Description
#The analyzer produces this diagnostic when an annotation consists of a single identifier, but that identifier is the name of a class rather than a variable. To create an instance of the class, the identifier must be followed by an argument list.
Example
#The following code produces this diagnostic because C
is a class, and a
class can't be used as an annotation without invoking a const
constructor
from the class:
dart
class C {
const C();
}
@C
var x;
Common fixes
#Add the missing argument list:
dart
class C {
const C();
}
@C()
var x;
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。