annotate_overrides

Group: style

Maturity: stable

Dart SDK: >= 2.0.0 • (Linter v0.1.11)

Since info is static, may be stale
recommendedflutterhas-fix

View all Lint Rules

Using the Linter

DO annotate overridden methods and fields.

This practice improves code readability and helps protect against unintentionally overriding superclass members.

BAD:

class Cat {
  int get lives => 9;
}

class Lucky extends Cat {
  final int lives = 14;
}

GOOD:

abstract class Dog {
  String get breed;
  void bark() {}
}

class Husky extends Dog {
  @override
  final String breed = 'Husky';
  @override
  void bark() {}
}