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:
class C {
const C();
}
@C
var x;
Common fixes
#Add the missing argument list:
class C {
const C();
}
@C()
var x;
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.