mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 20:41:24 +00:00
Use Future<void> when extract an async method that returns nothing.
R=brianwilkerson@google.com Change-Id: Ic148974ba587310c475795caf8ed0c8565d96909 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182664 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
43e4536ebb
commit
3be5f7c356
|
@ -861,6 +861,10 @@ class CorrectionUtils {
|
|||
}
|
||||
}
|
||||
|
||||
if (type is VoidType) {
|
||||
return 'void';
|
||||
}
|
||||
|
||||
throw StateError('(${type.runtimeType}) $type');
|
||||
}
|
||||
|
||||
|
|
|
@ -762,7 +762,8 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl
|
|||
} else if (_returnType == null) {
|
||||
variableType = null;
|
||||
if (_hasAwait) {
|
||||
returnType = _getTypeCode(typeProvider.futureDynamicType);
|
||||
var futureVoid = typeProvider.futureType2(typeProvider.voidType);
|
||||
returnType = _getTypeCode(futureVoid);
|
||||
} else {
|
||||
returnType = 'void';
|
||||
}
|
||||
|
|
|
@ -2431,7 +2431,7 @@ main() async {
|
|||
// end
|
||||
}
|
||||
|
||||
Future<dynamic> res() async {
|
||||
Future<void> res() async {
|
||||
int v = await getValue();
|
||||
print(v);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue