getDayOne method
Implementation
Future<List<Covid19CountryAllStatus>> getDayOne(
{@required String country, String status, bool live = false}) async {
if (live && status == null) status = 'confirmed';
var res = await _dio.get('/dayone/country/$country' +
(status != null ? '/status/$status' : '') +
(live ? '/live' : ''));
var data = res.data;
List<Covid19CountryAllStatus> list = 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;
}