-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'BuildContext's across async gaps false positive? #4955
Comments
A possible gap in the rule! I think this doesn't come up because it is more idiomatic to write |
Actually I cannot reproduce this at HEAD. Can you say what version of Dart/Flutter you are using, and provide a more full example (just the full function body there should be sufficient). |
Oops, apologies. I can reproduce. :D |
@srawlins no worries
|
Hmm, I might have not been clear. I mean that the idiomatic way to write |
@srawlins ho I see, I misunderstood what you meant, sorry. |
Fixes dart-lang/linter#4955 This also moves the implementation of `LinterContext.evaluateConstant()` to an extension getter on Expression, `computeConstantValue`, as the implementation does not need any information from LinterContext. An Expression can be evaluated with just the data it has on its own fields. This helps to simplify lint rules so that they may not need to pass around a LinterContext object around, like in use_build_context_synchronously, which doesn't use one currently. Change-Id: I555ae32f57de0968fd30b051e9a816dba8005574 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364521 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com>
Fixed with dart-lang/sdk@d728ec3 |
@srawlins you are the best 🤯 |
ok but:
Don't use 'BuildContext's across async gaps. Try rewriting the code to not use the 'BuildContext', or guard the use with a 'mounted' check.
The text was updated successfully, but these errors were encountered: