fiveDaysWeatherForecastByZipCode method

Future<WeatherForecastData> fiveDaysWeatherForecastByZipCode({
  1. required int zipCode,
  2. required String countryCode,
  3. Languages? language,
  4. WeatherUnits weatherUnits = WeatherUnits.IMPERIAL,
})

Implementation

Future<WeatherForecastData> fiveDaysWeatherForecastByZipCode(

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

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