rspec/rules/S1161/dart/rule.adoc
2024-07-12 11:57:36 +02:00

34 lines
729 B
Plaintext

== 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
}
----
== Resources
* https://dart.dev/tools/linter-rules/annotate_overrides[Dart Lint rule]