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

Int is not subtype of double || This error is because of open weather API #26

Open
kiranojhanp opened this issue Feb 6, 2021 · 2 comments

Comments

@kiranojhanp
Copy link

This error is because of open weather API

Replace

double temp = weatherData['main']['temp'];
temperature = temp.toInt();

with

if (weatherData['main']['temp'].runtimeType == double) {
 double temp = weatherData['main']['temp'];
 temperature = temp.toInt();
} else {
 temperature = weatherData['main']['temp'];
} 

and it should work.

Originally posted by @kiranojhanp in #20 (comment)

@kiranojhanp kiranojhanp changed the title This error is because of open weather API Int is not subtype of double || This error is because of open weather API Feb 6, 2021
@kiranojhanp kiranojhanp reopened this Feb 13, 2021
@MdRubayat
Copy link

Thanks a lot it worked!!

@kiranojhanp
Copy link
Author

no problem

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

2 participants