ArizArmeidi / FlutterWeather

Weather app created using Flutter and Dart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getDailyWeather uses the previous location

jimbeers opened this issue · comments

If I'm reading this correctly, in weatherProvider.dart, in searchweather,
the code is saving the latitude, and longitude, then calls searchweatherWithLocation, which sets the weather object that has been entered in the searchBar.dart.
Then calls getDailyweather, which uses the lat and long from before searchWeatherWithLocation was called, so it is the previous location.
simply moving the code around fixes this,
// first call this with will set the weather object
await searchWeatherWithLocation(location);
// then get that lat and long,
double latitude = weather.lat;
double longitude = weather.long;

await getDailyWeather(LatLng(latitude, longitude));

I'm planning to update the logic part of this app. I coded this when I first started Flutter so some of it still kinda messy and buggy. will update this soon when I have the time

fixed on 03cd5c0