i have a dynamic list which is like this below... i want to create another list which will have only "start" dates inside, how can i do this???
"bookings": [
{
"reference": "G1TVTZYSXZRHIIINN888",
"station": "G61703000566",
"connector": 0,
"start": "2021-07-22T17:00:00.000 00:00",
"stop": "2021-07-22T18:00:00.000 00:00",
"card": "D2E3422B",
"status": "Expired"
},
{
"reference": "VD2MQO39CQ1PSHMUDIHT",
"station": "G61703000567",
"connector": 1,
"start": "2021-07-22T18:00:00.000 00:00",
"stop": "2021-07-22T19:00:00.000 00:00",
"card": "D2E3422B",
"status": "Expired"
},
{
"reference": "EPQ05Q8DAHCOVNXMQCM3",
"station": "G61703000567",
"connector": 1,
"start": "2021-07-22T20:00:00.000 00:00",
"stop": "2021-07-22T21:00:00.000 00:00",
"card": "D2E3422B",
"status": "Expired"
}...
CodePudding user response:
Map over your json and return the start value
var data = jsonData["bookings"].map((e) => e["start"]).toList();
CodePudding user response:
Try List.map and map the start key then call toList() method