fix fromJson for CustomerCountry

This commit is contained in:
Anthony 2021-02-24 19:34:42 +00:00
parent acffaada17
commit b935c2a29d

View File

@ -26,10 +26,19 @@ class CustomerCountry {
} }
CustomerCountry.fromJson(Map<String, dynamic> json) { CustomerCountry.fromJson(Map<String, dynamic> json) {
if (json == null) {
return;
}
if (json['country_code'] != null) {
countryCode = json['country_code']; countryCode = json['country_code'];
}
if (json['name'] != null) {
name = json['name']; name = json['name'];
}
if (json['state'] != null) {
state = DefaultShippingState.fromJson(json['state']); state = DefaultShippingState.fromJson(json['state']);
} }
}
bool hasState() { bool hasState() {
return this.state != null && this.state.name != null ? true : false; return this.state != null && this.state.name != null ? true : false;