undefined_ extension_ getter
Details about the 'undefined_extension_getter' diagnostic produced by the Dart analyzer.
The getter '{0}' isn't defined for the extension '{1}'.
Description
#The analyzer produces this diagnostic when a static getter 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 getter named a:
extension E on String {}
var x = E.a;
Common fixes
#If the name of the getter is incorrect, then change it to the name of an existing static getter:
extension E on String {
static String get b => 'b';
}
var x = E.b;
If the getter isn't defined, then define it:
extension E on String {
static String get a => 'a';
}
var x = E.a;
Unless stated otherwise, the documentation on this site reflects Dart 3.13.3. Report an issue.