Skip to content

Commit

Permalink
Fix improper super calls in proper_super_calls.dart and add Disposabl…
Browse files Browse the repository at this point in the history
…e interface in proper_super_calls_test.dart (#160)

* Fix improper super calls in proper_super_calls.dart and add Disposable interface in proper_super_calls_test.dart

* Added a comment that abstract methods should be omitted in proper_super_alls
  • Loading branch information
4akloon authored Apr 18, 2024
1 parent cc9825e commit 133f96c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/src/lints/proper_super_calls/proper_super_calls_rule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ class ProperSuperCallsRule extends SolidLintRule {
context.registry.addMethodDeclaration(
(node) {
final methodName = node.name.toString();
final body = node.body;

if (methodName == _initState || methodName == _dispose) {
final statements = (node.body as BlockFunctionBody).block.statements;
if (methodName case _initState || _dispose
when body is BlockFunctionBody) {
final statements = body.block.statements;

_checkSuperCalls(
node,
Expand Down
5 changes: 5 additions & 0 deletions lint_test/proper_super_calls_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,8 @@ class MyClass {
dispose() {}
initState() {}
}

abstract interface class Disposable {
/// Abstract methods should be omitted by `proper_super_calls`
void dispose();
}

0 comments on commit 133f96c

Please sign in to comment.