Skip to main content

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:

dart
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:

dart
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:

dart
class A {}

class B extends A {}

If you don't want to inherit the implementation from the class, then remove the extends clause:

dart
class A {}

class B implements A {}