annotate_redeclares
Annotate redeclared members.
This rule is currently experimental and available as of Dart 3.2.
This rule has a quick fix available.
Details
#DO annotate redeclared members.
This practice improves code readability and helps protect against unintentionally redeclaring members or being surprised when a member ceases to redeclare (due for example to a rename refactoring).
BAD:
class C {
void f() { }
}
extension type E(C c) implements C {
void f() {
...
}
}
GOOD:
import 'package:meta/meta.dart';
class C {
void f() { }
}
extension type E(C c) implements C {
@redeclare
void f() {
...
}
}
Usage
#To enable the annotate_redeclares
rule, add annotate_redeclares
under linter > rules in your analysis_options.yaml
file:
linter:
rules:
- annotate_redeclares
Unless stated otherwise, the documentation on this site reflects Dart 3.5.4. Page last updated on 2024-07-03. View source or report an issue.