unnecessary-overrides

Same as unnecessary_overrides in Dart lints

Path
lint/complexity/unnecessary-overrides
Default
On (recommended)
Origin
Dart lints
Rule
469 of 512
recommended

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

example.dartdart
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();
  }
}
Remove this override because it only forwards to `super` unchanged.
11 @override
12 void foo() => super.foo();
Remove this override because it only forwards to `super` unchanged.
14 @override
15 void bar(int x) {
Remove this override because it only forwards to `super` unchanged.
19 @override
20 int get val => super.val;
Remove this override because it only forwards to `super` unchanged.
22 @override
23 set name(String s) => super.name = s;
Remove this override because it only forwards to `super` unchanged.
25 @override
26 int baz(int a, int b) {
Remove this override because it only forwards to `super` unchanged.
30 @override
31 void qux() {

Valid

example.dartdart
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.

falcon.jsonjson
{
  "linter": {
    "rules": {
      "complexity": {
        "unnecessary-overrides": "error"
      }
    }
  }
}

Or silence one occurrence with a suppression comment; the reason is required.

example.dartdart
// falcon-ignore lint/complexity/unnecessary-overrides: <reason>