-
Notifications
You must be signed in to change notification settings - Fork 131
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
type 'int' is not a subtype of type double this error coming #5
Comments
use var |
I got the similar problem. I used var then it got solved. |
thanx bro |
Where to replace var?? |
@simplygkgk @Samikhanonco instead of double temp replace it with var temp |
seems Dart is totally garbage |
Hi, I solved using var temp
thanks @Rohan2309 |
i observed that for some cities or (latitude and longitude), the JSON return temperature as int, example like below (23 not 23.00) so 23 is int not double. so i made generic change to convert it to double and then it works well. |
just initialize temperature with int then store the fetched location's temperature temporarily in var at last typecast it in int |
thanx it worked |
thanx it worked |
thanks to you i can solve proplem |
#26 |
unfortunately , I have the sem issue but the solution isn't workin well with my case |
No ... use num instead of double in this case. Always avoid var when possible.
or
I consider it also bad API design when numeric values flip between double and int in json, but unfortunately we have to deal with it in this case. |
@zoenie123 , There is a workaround if the json data flips between double and int. This helped me. Take a look. |
@rifat-22 I stand with my solution, it's the most simple and fast one. All other versions I have seen do conversion on conversion. No need. |
I tried this but it didn't work |
type 'int' is not a subtype of type double this error coming
The text was updated successfully, but these errors were encountered: