-
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
Future<void>/FutureOr<void> require returns? #32443
Comments
Agreed, when We would need a special exception for this, of course, and there may be other cases. We have had some discussions in #32177, and I've added a reference to this issue there. |
These are tricky cases, and I don't think we agree entirely on what to say about it. My personal guiding rules are that:
The third entry is the general rule for So, I would want the second and third examples to be valid, because they would be for We don't currently have a Dart 2 compatible specification for the |
The current situation is clearly just wrong: import 'dart:async';
void foo1() {
return;
}
Null foo2() {
return;
}
Future<void> foo3() async {
return; // warning • Missing return value after 'return' at test.dart:12:3 • return_without_value
}
Future<Null> foo4() async {
return;
}
void main() { } |
I think you can use like this:
|
With recent updates to the rules about returning (esp. dart-lang/language#941), there are no errors in the following: import 'dart:async';
void foo1() {
return;
}
Null foo2() {
return;
}
Future<void> foo3() async {
return;
}
Future<Null> foo4() async {
return;
} |
am getting this error on slider OnChange() function writting custom function that returns null this the error am getting |
The following triggers an analysis warning in
2.0.0-dev.32.0
:I can silence it with
return null;
... but can't that be automatic?The text was updated successfully, but these errors were encountered: