currentWeatherByZipCode method
Future<WeatherData>
currentWeatherByZipCode({
- required int zipCode,
- required String countryCode,
- Languages? language,
- WeatherUnits weatherUnits = WeatherUnits.IMPERIAL,
Implementation
Future<WeatherData> currentWeatherByZipCode(
/// 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('weather',
zipCode: zipCode,
countryCode: countryCode,
weatherUnits: weatherUnits,
language: language);
return WeatherData.fromJson(currentWeather);
} catch (err) {
rethrow;
}
}