Int is not subtype of double
Aditi10101999 opened this issue · comments
Aditi10101999 commented
when i try to run the app it shows this error "Int is not subtype of double" idk what to do
Sruthika B commented
Change the variable type to 'dynamic', It worked for me
Kiran Ojha commented
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.