Skip to main content

prefer-commenting-future-delayed

Warns when Future.delayed invocations do not have a descriptive comment.

Adding a comment to the Future.delayed invocation can help a future reader understand the reason for the delay.

Example

❌ Bad:

Future<void> fn() async {
...

// LINT: Prefer adding a comment to Future.delayed.
// Providing a clear description may help future readers better understand the reason for this delay.
await Future.delayed(Duration.zero);
}

✅ Good:

Future<void> fn() async {
...

// the reason for the delay ...
await Future.delayed(Duration.zero);
}