getByCountryTotal method
Implementation
Future<List> getByCountryTotal(
{@required String country, String status, String from, String to}) async {
var res = await _dio.get(
'/total/country/$country' + (status != null ? '/status/$status' : ''),
queryParameters: status != null ? {'from': from, 'to': to} : null);
var data = res.data;
List list = List();
if (status != null) {
for (var i in data) {
list.add(
Covid19CountryEx(
country: i['Country'],
countryCode: i['CountryCode'],
province: i['Province'],
city: i['City'],
cityCode: i['CityCode'],
lat: i['Lat'],
lon: i['Lon'],
cases: i['Cases'],
status: i['Status'],
date: i['Date'],
),
);
}
return list;
}
for (var i in data) {
list.add(
Covid19CountryAllStatus(
country: i['Country'],
countryCode: i['CountryCode'],
province: i['Province'],
city: i['City'],
cityCode: i['CityCode'],
lat: i['Lat'],
lon: i['Lon'],
confirmed: i['Confirmed'],
deaths: i['Deaths'],
recovered: i['Recovered'],
active: i['Active'],
date: i['Date'],
),
);
}
return list;
}