-
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
A #24149
Comments
That suggestion would effectively mean that there are two types of Futures, one where A more useful version would be to change the signature of If you use the All in all, we don't think the gain from such a feature is worth the complication it introduces. |
Why not add another method on Future after(callback()) => then((_) => callback()); It's like how Haskell's |
Changing |
Related to #2231:
It's not possible to have a Future because void is not a type. Okay, that's understandable. We can use
Future<dynamic>
instead, but that leads to awkward code, e.g.:Later on...
This doesn't work:
Either
doSomethingElse()
needs to be declared with a single, throw-away argument, or else pass a lambda tothen()
that disposes of the useless argument:I find this latter syntax a bit more difficult to understand, particularly to others not familiar with futures in Dart.
I think a simple solution would be to add a class (e.g. in dart:async) that is a sentinel indicating a future with no return value. The implementation can check if the type is this sentinel class and invoke the callback without any arguments.
The text was updated successfully, but these errors were encountered: