Hello,
I’m following the Flutter SDK instructions on how to retrieve JSON using custom classes, but keep getting an error and have been stuck, hope you can point out where I’m going wrong. I want to be able to do exhibit.images?.imageList?[0].url
for example.
I have the following classes:
@reflector
class Exhibit {
late JsonImageList? images;
}
@reflector
class JsonImageList {
List<ImageObject>? imageList;
}
@reflector
class ImageObject {
String? url;
String? copyrightText;
String? altText;
String? name;
}
This is the shape of my data:
{
"imageList": [
{
"url": "loooorem_url",
"name": "art_thing",
"altText": "Something",
"copyright": "beep"
},
{
"url": "lorem_ipsum",
"name": "art_thing_2",
"altText": "Something else",
"copyright": "boop"
}
]
}
The column in my table is called images
.
But I keep getting the following error: