extension_override_argument_not_assignable
Details about the 'extension_override_argument_not_assignable' diagnostic produced by the Dart analyzer.
The type of the argument to the extension override '{0}' isn't assignable to the extended type '{1}'.
Description
#The analyzer produces this diagnostic when the argument to an extension override isn't assignable to the type being extended by the extension.
Example
#The following code produces this diagnostic because 3 isn't a String:
extension E on String {
void method() {}
}
void f() {
E(3).method();
}
Common fixes
#If you're using the correct extension, then update the argument to have the correct type:
extension E on String {
void method() {}
}
void f() {
E(3.toString()).method();
}
If there's a different extension that's valid for the type of the argument, then either replace the name of the extension or unwrap the argument so that the correct extension is found.
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.