Consider the following Dart source code (Flutter project):
void foo() {
await bar();
}
Future<void> bar() async {
print("test");
}
This is causing the following error on Android Studio:
The built-in identifier 'await' can't be used as a type
.
If I change it to (await bar());
then I get the error Unexpected text 'await'
.
What am I missing here?
The foo()
method needs to be marked with async
.
Future<void> foo() async {
await bar();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With