Я пытаюсь собрать свое первое приложение для Android, используя дартс. Приложение идеально подберет близкие результаты, но я не могу получить изображения вместе с ними. Как мне сослаться на ссылку на фотографию в массиве "photos"? Дарт очень запутан.
import 'package:meta/meta.dart';
class Casino{
Casino({
@required this.name,
@required this.id,
@required this.photos,
@required this.overview,
this.favored,
});
String name,id,overview,photos;
bool favored;
Casino.fromJson(Map json)
: name = json["name"],
photos = json["photos"].getString("photo_reference"),
id = json["place_id"].toString(),
overview = json["overview"],
favored = false;
}
Где это указано:
Widget build(BuildContext context){
return Card(
child: Container(
height:200.0,
padding: EdgeInsets.all(10.0),
child: Row(
children: <Widget>[
casinoState.photos != null
? Hero(
child: Image.network(
"https://maps.googleapis.com/maps/api/place/photo?photoreference=${casinoState.photos}&sensor=false&maxheight=200&maxwidth=150&key=$key"),
tag:casinoState.id,
)
:Container(),
JSON Формат:
{
"html_attributions": [],
"results": [
{
"geometry": {
"location": {
"lat": 40.1186169,
"lng": -74.9532456
},
"viewport": {
"northeast": {
"lat": 40.1199658802915,
"lng": -74.95189661970849
},
"southwest": {
"lat": 40.1172679197085,
"lng": -74.95459458029151
}
}
},
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id": "080658566051e777f8c81b9a80db271629fd76a3",
"name": "Parx Casino",
"opening_hours": {
"open_now": true,
"weekday_text": []
},
"photos": [
{
"height": 1152,
"html_attributions": [
"<a href=\"https://maps.google.com/maps/contrib/117948925865341354264/photos\">Parx Casino</a>"
],
"photo_reference": "CmRaAAAABWy8pB7dKcz-M7iOpSdHMB1xmrN_EmFtxOh02aVemQsLdx4CqCsIOMIGKf6sHiEH2ukIJRNtF4b_NQ4SoXe-c65JxVnqo798RCyIjut9cq5pcquMx4-_D1TDPFjcLFEpEhDtNZHxFvLAeo6UESFM5vGMGhTuy6b3LoyD_KhCXudBmBHWaYlVmA",
"width": 2048
}
],