undefined_annotation
Undefined name '{0}' used as an annotation.
Description
#The analyzer produces this diagnostic when a name that isn't defined is used as an annotation.
Example
#The following code produces this diagnostic because the name undefined
isn't defined:
@undefined
void f() {}
Common fixes
#If the name is correct, but it isn't declared yet, then declare the name as a constant value:
const undefined = 'undefined';
@undefined
void f() {}
If the name is wrong, replace the name with the name of a valid constant:
@deprecated
void f() {}
Otherwise, remove the annotation.
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.