Am looking to use a public [api] for a personal project. This is a snippet of a full json data set.
"Countries": [
{
"Country": "ALA Aland Islands",
"CountryCode": "AX",
"Slug": "ala-aland-islands",
"NewConfirmed": 0,
"TotalConfirmed": 0,
"NewDeaths": 0,
"TotalDeaths": 0,
"NewRecovered": 0,
"TotalRecovered": 0,
"Date": "2020-04-05T06:37:00Z"
},
I've tried to access the object in the array, I even tried some answers I saw here, but it's not working for me either I keep getting my "loading data..." screen or I get a white screen with no errors. My code snippet below
class CountriesData {
String country;
String countryCode;
int confirmed;
int deaths;
int recovered;
int active;
DateTime date;
CountriesData(this.country, this.countryCode, this.confirmed, this.deaths,
this.recovered, this.active, this.date);
CountriesData.json(Map<String, dynamic> json) {
country = json['Country'];
countryCode = json['CountryCode'];
confirmed = json['Confirmed'];
deaths = json['Deaths'];
recovered = json['Recovered'];
active = json['Active'];
date = DateTime.parse(json['Date']);
}
}