Android Studio无法识别Dart关键字“ await”

时间:2018-12-25 22:10:09

标签: android-studio dart flutter

请考虑以下Dart源代码(Flutter项目):

void foo() {
  await bar();
}

Future<void> bar() async {
  print("test");
}

这在Android Studio上导致以下错误: The built-in identifier 'await' can't be used as a type

如果将其更改为(await bar());,则会收到错误Unexpected text 'await'

我在这里想念什么?

The built-in identifier 'await' can't be used as a type Unexpected text 'await'

1 个答案:

答案 0 :(得分:4)

x[:,:,:,0:1]方法需要标记为foo()

async