avoid-unnecessary-super
preset: recommended
Warns when a constructor has an unnecessary super
invocation or when an invocation has an unnecessary super
prefix.
Example
❌ Bad:
class Base {
int get x => 1;
}
class Subclass extends Base {
const Subclass() : super(); // LINT: This 'super' invocation is unnecessary. Try removing it.
int get y => super.x; // LINT: This 'super' prefix is unnecessary. Try removing it.
}
✅ Good:
class Subclass extends Base {
const Subclass();
int get x => 2;
int get y => super.x; // Correct, 'x' is overridden
}