londonappbrewery / Clima-Flutter-Completed

The completed code for the Clima Project - The Complete Flutter Development Bootcamp

Home Page:https://www.appbrewery.co/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

kiranojhanp opened this issue · comments

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)

Thanks a lot it worked!!

no problem