weatherHistory method
Implementation
Future<WeatherForecast?> weatherHistory(
{required DateTime date,
double? lat,
double? lng,
String? location}) async {
Map<String, dynamic> params = {
'key': WEATHER_API_KEY,
'dt': date.formatDate(formatType: 'yyyy-MM-dd'),
'aqi': 'no',
'alerts': 'no'
};
if (location != null && location.trim().isNotEmpty) {
params.addAll({'q': location});
} else if (lat != null && lng != null) {
params.addAll({'q': '$lat,$lng'});
}
NetworkResponse response = await _api.weatherHistory(params);
return response.data;
}