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 {}
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.