-
Notifications
You must be signed in to change notification settings - Fork 214
Avoid single void argument #1590
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
Comments
For this to work, we'd likely have to wrap the function going in so that it has the correct type. That is, assigning a function f of type Would the feature only work for I'm not sure that complexity outweighs just doing |
If you feel like, you can make an extension method, like: import 'dart:async';
void main() {
final s = StreamController<void>();
s.stream.listen(doSomething.v);
}
void doSomething() {}
extension FunctionVoider<T> on T Function() {
T Function(void) get v => (_) => this();
} |
Due to strong typing, I have to write a type for request.response.close().then((void _) { /* */ }); Can we use void like in C without request.response.close().then((void) { /* */ }); |
A feature that allows you to pass a function with no arguments to a function that accepts function with one void argument:
instead
The text was updated successfully, but these errors were encountered: