Akhele
Akhele

Reputation: 151

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

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

Upvotes: 3

Views: 10778

Answers (1)

Yauheni Prakapenka
Yauheni Prakapenka

Reputation: 1734

Change your methods to 'Future':

Future<void> fetchSearch(String input) async {

and

Future<void>  fetchLocation() async {

Upvotes: 10

Related Questions