class StateModel { late int id; late String countryCode; late String code; late String defaultName; late int countryId; late List translations; StateModel({ required this.id, required this.countryCode, required this.code, required this.defaultName, required this.countryId, required this.translations, }); StateModel.fromJson(Map json) { id = json['id']; countryCode = json['country_code']; code = json['code']; defaultName = json['default_name']; countryId = json['country_id']; if (json['translations'] != null) { translations = []; json['translations'].forEach((v) { translations.add(new StateTranslations.fromJson(v)); }); } } static List listFromJson(list) => List.from(list.map((x) => StateModel.fromJson(x))); } class StateTranslations { late int id; late String locale; late String defaultName; late int countryStateId; StateTranslations({ required this.id, required this.locale, required this.defaultName, required this.countryStateId, }); StateTranslations.fromJson(Map json) { id = json['id']; locale = json['locale']; defaultName = json['default_name']; countryStateId = json['country_state_id']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['locale'] = this.locale; data['default_name'] = this.defaultName; data['country_state_id'] = this.countryStateId; return data; } }