getWeather method Null safety
Implementation
Future<OpenWeather?> getWeather({
String units = "metric",
required double lat,
required double lon,
String lang = "en",
}) async {
final response = await get("weather", params: {
"appid": weatherKey,
"lat": lat.toString(),
"lon": lon.toString(),
"lang": lang,
"units": "metric",
"mode": "json",
});
if (response != null) {
return OpenWeather.fromJson(response);
} else {
return null;
}
}