avoid-async-callback-in-fake-async
Warns when an async callback is passed to FakeAsync
.
FakeAsync
implementation does not await an async callback and the test will pass even if it should not.
Example
❌ Bad:
void main() {
// LINT: Async callbacks passed to 'FakeAsync' are not awaited making the test to always pass. Try removing the 'async' keyword.
FakeAsync().run((fakeAsync) async {
...
});
// LINT: Async callbacks passed to 'FakeAsync' are not awaited making the test to always pass. Try removing the 'async' keyword.
fakeAsync((fakeAsync) async {
...
});
}
✅ Good:
void main() {
FakeAsync().run((fakeAsync) {});
fakeAsync((fakeAsync) {});
}