-
Notifications
You must be signed in to change notification settings - Fork 1.7k
proposal: mention that an async function has no await keyword in the function body #59454
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
An I don't see a warning if an |
From my understanding, if there is no I see this to be deliberated when implementing an interface for example but I imagine the linter can detect if you overwrite something. I would be happy with false positives in my case. If I can remove a bunch of Remember that linters are optional and activated manually. |
From the outside, the signature is pretty much the function. So no difference except everything about how to use the function. It's possibly a reasonable lint while developing, if you notice that a function that you made async because it needed to be, now no longer needs to be async. It's useful during the design phase, or for private helper functions, but not for public API. |
@lrhn I agree with you. |
This lint could also come with a quick fix/assist that does the opposite of what "Convert to async function body" assist does. |
From @DanTup's comment on #58862:
info_diagnostic.mp4
I think this would be a great place to have a similar thing. Where it is not an "info" lint, but just a "nudge" (bwilkerson's nickname for this). If this was a thing, I would also probably expect that the only private functions/methods part of this could go away. Also, this could trigger only at non-overridden methods, so this is even safer to use. |
I'd also like to mention dart-lang/language#870 related to the return of |
when you modify your code, you can remove the last
await
in a function so the function can become synchronous but nothing tells you that and you keepawait
something that doesn't need to.The text was updated successfully, but these errors were encountered: