Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I write the city name and pressing on "Get Weather" it throws me this error in the console #15

Open
shaishalevss opened this issue Sep 22, 2020 · 5 comments

Comments

@shaishalevss
Copy link

shaishalevss commented Sep 22, 2020

It also shows me the default location(of the android emulator), but I noticed in the console that I get this error:
E/flutter (19578): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: Class 'Future' has no instance method '[]'.
E/flutter (19578): Receiver: Instance of 'Future'
E/flutter (19578): Tried calling:

this is my getCityWeather method:
Future getCityWeather(String cityName) async {
NetworkHelper networkHelper = NetworkHelper('$openWeatherMapURL?q=$cityName&appid=$apiKey&units=metric');
var weatherData = await networkHelper.getData();
return weatherData;
}

please help me, I really want to finish this project already.

@shaishalevss
Copy link
Author

I was able to fix that.

@brobert04
Copy link

Can you tell me how did you fix it?

@Saimonkabir
Copy link

How did you fix the issue?

@azinmapar
Copy link

azinmapar commented Apr 18, 2023

same problem

@prashantsumfactor
Copy link

@azinmapar , @shaishalevss , @brobert04
You should try this in your network helper class [ decode response body by json converter ]
Screenshot 2023-05-23 at 8 40 29 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants