class LocationApiResponse { final List results; LocationApiResponse({ this.results, }); LocationApiResponse copyWith({ List results, }) { return LocationApiResponse( results: results ?? this.results, ); } factory LocationApiResponse.fromMap(Map map) { return LocationApiResponse( results: List.from( (map['results']).map( (x) => LocationDataFromResponse.fromMap(x as Map), ), ), ); } } class LocationDataFromResponse { final String place; final List bbox; LocationDataFromResponse({ this.place, this.bbox, }); LocationDataFromResponse copyWith({ String place, List bbox, }) { return LocationDataFromResponse( place: place ?? this.place, bbox: bbox ?? this.bbox, ); } factory LocationDataFromResponse.fromMap(Map map) { return LocationDataFromResponse( place: map['place'] as String, bbox: List.from( (map['bbox']), ), ); } }