unnecessary-overrides
Same as unnecessary_overrides in Dart lints
- Group
- Complexity
- Path
lint/complexity/unnecessary-overrides- Default
- On (recommended)
- Origin
- Dart lints
- Rule
- 469 of 512
Flags a member that does nothing but forward to super with
the same arguments and resolved contract.
Such an override adds visual noise and a maintenance burden without changing
behavior — delete it and the inherited implementation stays in force.
Resolved inherited metadata and signatures preserve meaningful overrides,
including documentation, body comments, narrower contracts, and visibility changes.
Ordinary Flutter State forwarding overrides belong here; only overrides that
drop inherited @protected belong to avoid-unnecessary-overrides-in-state.
Invalid
class Base {
void foo() {}
void bar(int x) {}
int get val => 0;
set name(String s) {}
int baz(int a, int b) => 0;
void qux() {}
}
class Derived extends Base {
@override
void foo() => super.foo();
@override
void bar(int x) {
super.bar(x);
}
@override
int get val => super.val;
@override
set name(String s) => super.name = s;
@override
int baz(int a, int b) {
return super.baz(a, b);
}
@override
void qux() {
super.qux();
}
} @override void foo() => super.foo(); @override void bar(int x) { @override int get val => super.val; @override set name(String s) => super.name = s; @override int baz(int a, int b) { @override void qux() {Valid
class Base {
void foo() {}
void bar(int x) {}
int get val => 0;
void baz([int x = 0]) {}
}
const protected = 'protected';
class Derived extends Base {
@override
void foo() {
print('extra');
super.foo();
}
@override
int get val => super.val + 1;
@override
void bar(int x) => super.bar(x + 1);
@override
@protected
void extraAnnotated() => superCall();
@override
void baz([int x = 0]) => super.baz(x);
void notOverride() => helper();
}Configure unnecessary-overrides
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"complexity": {
"unnecessary-overrides": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/complexity/unnecessary-overrides: <reason>More complexity rules
- widget-tree-depthflutter
Limits the depth of an inline Flutter widget construction tree.
- avoid-classes-with-only-static-members
avoid_classes_with_only_static_membersFlags a class that declares only static members.
- avoid-collapsible-if
Flags an else-free
ifwhose only then-statement is another else-freeif. - avoid-complex-arithmetic-expressions
Reports arithmetic expressions containing too many terms.
- avoid-complex-conditions
Flags boolean expressions with more logical operands than the configured threshold.
- avoid-complex-loop-conditions
Flags loop conditions with more logical operands than the configured threshold.
- avoid-function-literals-in-foreach-calls
avoid_function_literals_in_foreach_callsFlags a function literal passed to an Iterable's
forEach. - avoid-if-with-many-branches
Reports long if/else-if chains; replace them with a switch or extracted helpers.