override_on_non_overriding_member
The field doesn't override an inherited getter or setter.
The getter doesn't override an inherited getter.
The method doesn't override an inherited method.
The setter doesn't override an inherited setter.
Description
#The analyzer produces this diagnostic when a class member is annotated with
the @override
annotation, but the member isn't declared in any of the
supertypes of the class.
Example
#The following code produces this diagnostic because m
isn't declared in
any of the supertypes of C
:
class C {
@override
String m() => '';
}
Common fixes
#If the member is intended to override a member with a different name, then update the member to have the same name:
class C {
@override
String toString() => '';
}
If the member is intended to override a member that was removed from the superclass, then consider removing the member from the subclass.
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。