fiveDaysWeatherForecastByLocation method

Future<WeatherForecastData> fiveDaysWeatherForecastByLocation({
  1. required double latitude,
  2. required double longitude,
  3. Languages? language,
  4. WeatherUnits weatherUnits = WeatherUnits.IMPERIAL,
})

Implementation

Future<WeatherForecastData> fiveDaysWeatherForecastByLocation(

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

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