This repository was archived by the owner on Nov 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-18
lines changed
Expand file tree Collapse file tree 3 files changed +10
-18
lines changed Original file line number Diff line number Diff line change 88 interpolations at the beginning and end of String literals.
99- update ` unnecessary_getters_setters ` to allow for setters with non-basic
1010 assignments (for example, ` ??= ` or ` += ` ).
11- - update ` unnecessary_overrides ` to allow overrides with a doc comment only if
12- they are abstract.
1311
1412# 1.6.1
1513
Original file line number Diff line number Diff line change @@ -39,11 +39,10 @@ class A extends B {
3939
4040It's valid to override a member in the following cases:
4141
42- * if a return type or a parameter type is not the exact same type as the
43- super method,
42+ * if a type ( return type or a parameter type) is not the exactly the same as the
43+ super method,
4444* if the `covariant` keyword is added to one of the parameters,
45- * if a documentation comment is present on the member, and the member is
46- abstract,
45+ * if documentation comments are present on the member,
4746* if the member has annotations other than `@override`.
4847
4948`noSuchMethod` is a special method and is not checked by this rule.
@@ -100,12 +99,11 @@ abstract class _AbstractUnnecessaryOverrideVisitor extends SimpleAstVisitor {
10099
101100 @override
102101 void visitMethodDeclaration (MethodDeclaration node) {
103- // ` noSuchMethod` is mandatory to proxify.
102+ // noSuchMethod is mandatory to proxify
104103 if (node.name.name == 'noSuchMethod' ) return ;
105104
106- // It's ok to override a method with an abstract declaration, in order to
107- // have better documentation.
108- if (node.documentationComment != null && node.isAbstract) return ;
105+ // it's ok to override to have better documentation
106+ if (node.documentationComment != null ) return ;
109107
110108 inheritedMethod = getInheritedElement (node);
111109 declaration = node;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class Base {
2020 int m2 ({int a, int b}) => 0 ;
2121 int m3 ({int a, int b}) => 0 ;
2222 int operator + (other) => 0 ;
23- Base operator ~ () => null ;
23+ Base operator ~ ()=> null ;
2424 @override
2525 int get hashCode => 13 ;
2626}
@@ -53,7 +53,7 @@ class Parent extends Base {
5353 int operator + (other) => super + other; // LINT
5454
5555 @override
56- Base operator ~ () => ~ super ; // LINT
56+ Base operator ~ ()=> ~ super ; // LINT
5757
5858 @override
5959 @myAnnotation
@@ -195,11 +195,7 @@ class D implements C {
195195}
196196
197197class E extends C {
198- /// Overridden for documentation, but has a body.
198+ /// it's ok to override to provide better documentation
199199 @override
200- num get g => super .g; // LINT
201-
202- /// Overridden for documentation, without a body.
203- @override
204- num m (int v); // OK
200+ num get g => super .g; // OK
205201}
You can’t perform that action at this time.
0 commit comments