Flutter : This expression has a type of 'void' so its value can't be used

Viewed 4167

I have a problem with the two lines after adding async and await a new two errors appear in the await lines

"This expression has a type of 'void' so its value can't be used."

this is the code with the problem

  void onTextFieldSubmitted(String input) async {
    
    await fetchSearch(input);
    await fetchLocation();
    
  }

you can see the source code here https://github.com/Akhele/Flutter-Weather-App/blob/master/lib/main.dart

1 Answers

Change your methods to 'Future':

Future<void> fetchSearch(String input) async {

and

Future<void>  fetchLocation() async {
Related