rspec/rules/S1161/dart/rule.adoc

34 lines
729 B
Plaintext
Raw Normal View History

2024-07-10 15:49:32 +02:00
== Why is this an issue?
While not mandatory, using the `@Override` annotation on compliant members improves readability by making it explicit that members are overridden.
=== Noncompliant code example
[source,dart,diff-id=1,diff-type=noncompliant]
----
class ParentClass {
bool doSomething(){/*...*/}
}
class FirstChildClass extends ParentClass {
bool doSomething(){/*...*/} // Noncompliant
}
----
=== Compliant solution
[source,dart,diff-id=1,diff-type=compliant]
----
class ParentClass {
bool doSomething(){/*...*/}
}
class FirstChildClass extends ParentClass {
@override
bool doSomething(){/*...*/} // Compliant
}
----
2024-07-11 15:00:51 +02:00
== Resources
* https://dart.dev/tools/linter-rules/annotate_overrides[Dart Lint rule]