-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Delinting future awaits round 1 #10760
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
Conversation
|
LGTM! |
| final String branch = _channel == 'alpha' ? 'alpha' : 'master'; | ||
| final DateTime remoteFrameworkCommitDate = DateTime.parse(await FlutterVersion.fetchRemoteFrameworkCommitDate(branch)); | ||
| // fire and forget since nothing subsequent depends on it. Hope there's a flush/sync mechanism. | ||
| // ignore: unawaited_futures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks ok in this case but as a general rule prefer to put the //ignore at the end of the offending line rather than before it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be a bug. Doesn't seem to actually work on multi-line expressions when it's like:
aFutureReturningFunction(
a,
b
); // ignore: unawaited_futures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @leafpetersen but maybe try:
aFutureReturningFunction( // ignore: unawaited_futures
a,
b
);
| try { | ||
| final String branch = _channel == 'alpha' ? 'alpha' : 'master'; | ||
| final DateTime remoteFrameworkCommitDate = DateTime.parse(await FlutterVersion.fetchRemoteFrameworkCommitDate(branch)); | ||
| // fire and forget since nothing subsequent depends on it. Hope there's a flush/sync mechanism. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hope seems optimistic...
cc @yjbanov did you mean to not wait for this future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bug. I think we should await. I usually leave a comment if I'm dropping a Future on the floor intentionally.
| ); | ||
| await new Future<Null>.delayed(kPauseToLetUserReadTheMessage); | ||
| await Future.wait<Null>(<Future<Null>>[ | ||
| saveWarningStampFuture, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to just inline the future-returning calls in the Future.wait call, fwiw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sent a follow up #10786
Do wish this syntax was more succinct/readable though
#10754
Before I get too far, here's a sampling to make sure it's what we want.