-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New Future constructor: Future.void #53364
Comments
cc @jakemac53 |
A related thing I was realizing today is that once we are in sound mode everywhere, I believe that we have a much stronger case for changing In a sound world, this only changes a guaranteed runtime failure into a static failure, where in an unsound world the runtime failure was not guaranteed, so it was a harder sell. |
Would love to make that breaking change (and I'm sure there are a couple of other similar functions with an optional argument which is only really optional if the type parameter is nullable). Adding We have had enough trouble with out internal (The internal "null future" was added as a hack to make some other code recognize it and avoid awaiting it, to be timing compatible with an earlier non-null-safe API where someone could return I'd probably make the migration just add the |
|
If we want to change the signature of
Future.value
to feature a required parameter, then the shorthand,Future.value()
(with zero args), used forFuture<void>
s orFuture<Null>
perhaps, would disappear.Future.void()
would be a nice way to migrate code incrementally. Would there maybe beconst
/ performance benefits to this as well?Is there a similar incremental move for
Completer.complete()
(zero arguments)? Maybe aCompleter.completeVoid()
method? It would be cool to make it an extension method, in an extension onCompleter<void>
. Unfortunately, an extension onCompleter<void>
matches statically on any-and-all Completer types.The text was updated successfully, but these errors were encountered: