Skip to main content

undefined_super_operator

Details about the 'undefined_super_operator' diagnostic produced by the Dart analyzer.

The operator '{0}' isn't defined in a superclass of '{1}'.

Description

#

The analyzer produces this diagnostic when an operator is invoked on super, but no superclass of the enclosing declaration defines that operator.

Example

#

The following code produces this diagnostic because the superclass A doesn't define the operator +:

dart
class A {}
​
class B extends A {
  int m() => super + 0;
}

Common fixes

#

If the operator isn't defined, then add it to a superclass:

dart
class A {
  int operator +(int other) => 0;
}
​
class B extends A {
  int m() => super + 0;
}

Otherwise, remove the invocation.