【发布时间】:2019-05-24 08:31:01
【问题描述】:
考虑以下 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'。
我在这里错过了什么?
【问题讨论】:
-
它必须在异步函数中使用
标签: android-studio dart flutter