-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Lint Rules to Enable
We currently have two important lint rules disabled in our analysis_options.yaml:
# TODO: Enable unnecessary_async and unawaited_futures rules
unnecessary_async: falseWhat these lints do
unawaited_futures
This lint warns when a Future is not awaited within an async function body. This helps prevent bugs where:
- A function is called that returns a Future, but the result is accidentally ignored
- Errors in the Future are silently dropped rather than properly handled
- Functions that should complete before moving on actually run in parallel
When you genuinely want to fire-and-forget a Future, you should explicitly mark it with unawaited() from dart:async.
unnecessary_async
This lint flags functions that are marked as async but don't contain any await expressions. These functions can be simplified to synchronous functions, which:
- Run faster (avoiding async machinery overhead)
- Are easier to reason about
- Allow calling code to avoid unnecessary await expressions
Action Required
We should review the codebase and carefully evaluate all instances where:
- Futures are not being awaited
- Functions are unnecessarily marked as async
We need to make deliberate decisions about how to handle each case, such as:
- Adding proper await statements
- Explicitly marking intentionally unawaited futures with unawaited()
- Removing unnecessary async keywords
Once this review is complete, we can enable these rules in analysis_options.yaml to prevent similar issues in the future."
Metadata
Metadata
Assignees
Labels
No labels