inconsistent_inheritance
Superinterfaces don't have a valid override for '{0}': {1}.
Description
#The analyzer produces this diagnostic when a class inherits two or more conflicting signatures for a member and doesn't provide an implementation that satisfies all the inherited signatures.
Example
#The following code produces this diagnostic because C
is inheriting the declaration of m
from A
, and that implementation isn't consistent with the signature of m
that's inherited from B
:
class A {
void m({int? a}) {}
}
class B {
void m({int? b}) {}
}
class C extends A implements B {
}
Common fixes
#Add an implementation of the method that satisfies all the inherited signatures:
class A {
void m({int? a}) {}
}
class B {
void m({int? b}) {}
}
class C extends A implements B {
void m({int? a, int? b}) {}
}
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.