-
Notifications
You must be signed in to change notification settings - Fork 218
Use a new future instead of a cached future from another zone #831
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
As far as I can tell the comment doesn't make sense -- you don't pay the microtask hit unless you await the future. Fixes dart-lang#830
Interestingly, it was added in #546 which suggests that this might be needed to not break Flutter in some other way. So maybe this PR is not a good fix for the zone bug. |
@Hixie - here's the original thread with a link to a Travis failure that I believe is the issue Can you confirm whether this change causes a similar problem? |
This sounds related to dart-lang/sdk#32556 We had to do a hacky work around here: #787 Can the same approach apply? |
Another pattern I'd be curious to try: _emptyCallback() {}
final _emptyFuture = new Future.sync(_emptyCallback): |
afaik, |
Can you post the link? |
😳 |
Ah, yes, I remember that! So here's the test/line that was affected: |
Ok, in flutter/flutter#17415, I've created a test that:
Further, I've verified that this PR does not regress system_chrome_test.dart. tldr: this fix LGTM |
@grouma can you confirm that the quiver tests and package:fake_async tests also still pass with this change? I would only expect this to make things better for those packages, not worse, but we should double check. |
(I don't have commit rights in this repo, so when this is ready to land, please feel free to land it. :-) Thanks!) |
package:fake_async fails here: https://github.com/dart-lang/fake_async/blob/master/test/fake_async_test.dart#L461 package:quiver fails here: https://github.com/google/quiver-dart/blob/master/test/testing/async/fake_async_test.dart#L567 |
Two other possibilities to try:
|
Note that nbosch@ meant: |
@grouma adding a dependency override at the bottom of https://github.com/flutter/flutter/blob/master/packages/flutter_test/pubspec.yaml#L77 was working for me yesterday - does it work for you? (you'll need to run |
Ran a bunch of tests with the various options. The only thing that passes for all tests in |
As far as I can tell the comment doesn't make sense -- you don't pay the microtask hit unless you await the future.
Fixes #830