我们如何在 flutter 中获取特定的 json 对象列表

how do we get specific json object list in flutter

我有一个json这样格式的数据

{
    "ID": 2,
    "Name": "krish",
    "info": [{
            "Time": "07:30:00",
            "Image": "https://www.ingredion.com/content/dam/ingredion/usca-images/food/meat/cheeseburger-bread_720x560.jpg",
            "Notes": "Test"
        }, {
            "Time": "08:30:00",
            "Image": "https://www.refrigeratedfrozenfood.com/ext/resources/NEW_RD_Website/DefaultImages/default-pasta.jpg",
            "Notes": "Test1"
        }, {
            "Time": "09:30:00",
            "Image": "https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80",
            "Notes": "Testw"
        }
    ],
    "status": 5,
    "data": "passed"
}

我们如何仅使用 flutter 获取所有“图像”数据。 提前致谢。

你可以

final responseMap = jsonDecode(responseString);
final infoList = responseMap['info'];
final imageList = infoList.map((info) => info['Image']).toList();

imageList 将包含所有图像链接作为字符串列表。