class LocationIQ { String? placeId; String? licence; String? osmType; String? osmId; String? lat; String? lon; String? displayName; Address? address; List? boundingbox; LocationIQ({ this.placeId, this.licence, this.osmType, this.osmId, this.lat, this.lon, this.displayName, this.address, this.boundingbox, }); LocationIQ.fromJson(Map json) { placeId = json['place_id']; licence = json['licence']; osmType = json['osm_type']; osmId = json['osm_id']; lat = json['lat']; lon = json['lon']; displayName = json['display_name']; address = json['address'] != null ? Address.fromJson(json['address']) : null; boundingbox = json['boundingbox'].cast(); } Map toJson() { final Map data = {}; data['place_id'] = placeId; data['licence'] = licence; data['osm_type'] = osmType; data['osm_id'] = osmId; data['lat'] = lat; data['lon'] = lon; data['display_name'] = displayName; if (address != null) { data['address'] = address!.toJson(); } data['boundingbox'] = boundingbox; return data; } } class Address { String? houseNumber; String? road; String? village; String? county; String? state; String? postcode; String? country; String? countryCode; // Optional: Kurzadresse für einfachere Anzeige String? shortAddress; Address({ this.houseNumber, this.road, this.village, this.county, this.state, this.postcode, this.country, this.countryCode, // Optional: Kurzadresse generieren this.shortAddress, }); Address.fromJson(Map json) { houseNumber = json['house_number']; road = json['road']; village = json['village']; county = json['county']; state = json['state']; postcode = json['postcode']; country = json['country']; countryCode = json['country_code']; // Optional: Kurzadresse generieren (z.B. "Test Street 123, 4812 Test Village") shortAddress = [ if (road != null) road, if (houseNumber != null) '$houseNumber,', if (postcode != null) postcode, if (village != null) '$village,', if (county != null) '$county', ].join(' '); } Map toJson() { final Map data = {}; data['house_number'] = houseNumber; data['road'] = road; data['village'] = village; data['county'] = county; data['state'] = state; data['postcode'] = postcode; data['country'] = country; data['country_code'] = countryCode; data['short_address'] = shortAddress; return data; } }