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