implements_super_class
'{0}' can't be used in both the 'extends' and 'implements' clauses.
'{0}' can't be used in both the 'extends' and 'with' clauses.
Description
#The analyzer produces this diagnostic when a class is listed in the
extends
clause of a class declaration and also in either the
implements
or with
clause of the same declaration.
Example
#The following code produces this diagnostic because the class A
is used
in both the extends
and implements
clauses for the class B
:
class A {}
class B extends A implements A {}
The following code produces this diagnostic because the class A
is used
in both the extends
and with
clauses for the class B
:
mixin class A {}
class B extends A with A {}
Common fixes
#If you want to inherit the implementation from the class, then remove the
class from the implements
clause:
class A {}
class B extends A {}
If you don't want to inherit the implementation from the class, then remove
the extends
clause:
class A {}
class B implements A {}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。