getForecastWeatherByCityName method

Future<ForecastWeather> getForecastWeatherByCityName(
  1. String cityName, {
  2. int forecastDays = 1,
  3. bool airQualityIndex = false,
  4. bool alerts = false,
})

Fetch Forecast API data by city name.

Implementation

Future<ForecastWeather> getForecastWeatherByCityName(String cityName,
    {int forecastDays = 1,
    bool airQualityIndex = false,
    bool alerts = false}) async {
  Map<String, dynamic>? jsonResponse =
      await _sendRequest<Map<String, dynamic>>(APIType.forecast,
          cityName: cityName,
          forecastDays: forecastDays,
          airQualityIndex: airQualityIndex,
          alerts: alerts);

  return ForecastWeather(jsonResponse!);
}