Flutter : 这个表达式的类型是 'void' 所以它的值不能被使用
Flutter : This expression has a type of 'void' so its value can't be used
我对这两条线有问题
添加异步和等待之后
等待行中出现新的两个错误
“此表达式的类型为 'void',因此无法使用其值。”
这是有问题的代码
void onTextFieldSubmitted(String input) async {
await fetchSearch(input);
await fetchLocation();
}
你可以在这里看到源代码
https://github.com/Akhele/Flutter-Weather-App/blob/master/lib/main.dart
将您的方法更改为 'Future':
Future<void> fetchSearch(String input) async {
和
Future<void> fetchLocation() async {
我对这两条线有问题 添加异步和等待之后 等待行中出现新的两个错误
“此表达式的类型为 'void',因此无法使用其值。”
这是有问题的代码
void onTextFieldSubmitted(String input) async {
await fetchSearch(input);
await fetchLocation();
}
你可以在这里看到源代码 https://github.com/Akhele/Flutter-Weather-App/blob/master/lib/main.dart
将您的方法更改为 'Future':
Future<void> fetchSearch(String input) async {
和
Future<void> fetchLocation() async {