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
  • Loading branch information
4akloon committed Apr 17, 2024
1 parent 7f08163 commit 327f842
Show file tree
Hide file tree
Showing 2 changed files with 8 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
4 changes: 4 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,7 @@ class MyClass {
dispose() {}
initState() {}
}

abstract interface class Disposable {
void dispose();
}

0 comments on commit 327f842

Please sign in to comment.