Skip to main content

avoid-async-callback-in-fake-async

added in: 1.9.0
🛠

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
FakeAsync().run((fakeAsync) async {
...
});

// LINT
fakeAsync((fakeAsync) async {
...
});
}

✅ Good:

void main() {
FakeAsync().run((fakeAsync) {});

fakeAsync((fakeAsync) {});
}