undefined_ extension_ setter
Details about the 'undefined_extension_setter' diagnostic produced by the Dart analyzer.
The setter '{0}' isn't defined for the extension '{1}'.
Description
#The analyzer produces this diagnostic when a static setter is referenced, but isn't defined by the specified extension.
Example
#
The following code produces this diagnostic because the extension E
doesn't declare a static setter named a:
extension E on String {}
void f() {
E.a = 3;
}
Common fixes
#If the name of the setter is incorrect, then change it to the name of an existing static setter:
extension E on String {
static set b(int _) {}
}
void f() {
E.b = 3;
}
If the setter isn't defined, then define it:
extension E on String {
static set a(int _) {}
}
void f() {
E.a = 3;
}
Unless stated otherwise, the documentation on this site reflects Dart 3.13.3. Report an issue.