fetchWeather method

Future<void> fetchWeather(
  1. double lat,
  2. double lon,
  3. 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();
}