Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

fix: make avoid-redundant-async handle yield #1021

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* chore: changed min `SDK` version to `2.18.0`.
* chore: restrict `analyzer` version to `>=5.1.0 <5.2.0`.
* chore: restrict `analyzer_plugin` version to `>=0.11.0 <0.12.0`.
* fix: make [`avoid-redundant-async`](https://dartcodemetrics.dev/docs/rules/common/avoid-redundant-async) correctly handle yield.

## 4.19.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,11 @@ class _AsyncVisitor extends RecursiveAstVisitor<void> {

hasValidAsync = true;
}

@override
void visitYieldStatement(YieldStatement node) {
super.visitYieldStatement(node);

hasValidAsync = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ class SomeClass {
Future<void> returnNullable(SomeClass? instance) async {
return instance?.report([]);
}

Stream<int> buildStream() async* {
for (int i = 0; i < 10; i++) {
yield i;
}
}
}