fiveDaysWeatherForecastByCityName method

Future<WeatherForecastData> fiveDaysWeatherForecastByCityName({
  1. required String cityName,
  2. Languages? language,
  3. WeatherUnits weatherUnits = WeatherUnits.IMPERIAL,
})

Implementation

Future<WeatherForecastData> fiveDaysWeatherForecastByCityName(

    /// Retrieves the weatherForecastData object by the current city name
    /// In order to use the function, [cityName] is required
    /// It is possible to set the weather units by setting a specific value in [weatherUnits]
    {required String cityName,
    final Languages? language,
    WeatherUnits weatherUnits = WeatherUnits.IMPERIAL}) async {
  try {
    Map<String, dynamic> currentWeather = await _sendRequest('forecast',
        cityName: cityName, weatherUnits: weatherUnits, language: language);

    return WeatherForecastData.fromJson(currentWeather);
  } catch (err) {
    rethrow;
  }
}