fetchWeather method
- double lat,
- double lon,
- WeatherApi weatherApi
Implementation
Future<void> fetchWeather(double lat, double lon, WeatherApi weatherApi) async {
isLoading = true;
notifyListeners();
try {
currentWeather = await weatherApi.getCurrentPrecipitation(lat: lat, lon: lon);
errorMessage = null;
} catch (e) {
errorMessage = e.toString();
currentWeather = null;
}
isLoading = false;
notifyListeners();
}