This repository was archived by the owner on Jul 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
lib/src/analyzers/lint_analyzer/rules/rules_list/use_setstate_synchronously Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -64,10 +64,9 @@ class _AsyncSetStateVisitor extends RecursiveAstVisitor<void> {
64
64
}
65
65
66
66
node.condition.visitChildren (this );
67
- final oldMounted = mounted;
68
67
final newMounted = _extractMountedCheck (node.condition);
69
-
70
68
mounted = newMounted.or (mounted);
69
+
71
70
final beforeThen = mounted;
72
71
node.thenStatement.visitChildren (this );
73
72
final afterThen = mounted;
@@ -86,8 +85,6 @@ class _AsyncSetStateVisitor extends RecursiveAstVisitor<void> {
86
85
mounted = beforeThen != afterThen
87
86
? afterThen
88
87
: _extractMountedCheck (node.condition, permitAnd: false );
89
- } else {
90
- mounted = oldMounted;
91
88
}
92
89
}
93
90
@@ -103,7 +100,9 @@ class _AsyncSetStateVisitor extends RecursiveAstVisitor<void> {
103
100
mounted = newMounted.or (mounted);
104
101
node.body.visitChildren (this );
105
102
106
- mounted = _blockDiverges (node.body) ? _tryInvert (newMounted) : oldMounted;
103
+ if (_blockDiverges (node.body)) {
104
+ mounted = _tryInvert (newMounted).or (oldMounted);
105
+ }
107
106
}
108
107
109
108
@override
You can’t perform that action at this time.
0 commit comments