fiveDaysWeatherForecastByCityName method
Future<WeatherForecastData>
fiveDaysWeatherForecastByCityName({
- required String cityName,
- Languages? language,
- WeatherUnits weatherUnits = WeatherUnits.IMPERIAL,
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
Implementation
Future<WeatherForecastData> fiveDaysWeatherForecastByCityName(
{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;
}
}