You can simple use your foreach loop and add items in this.
allRows.forEach((row) {
items.add(
{
{
"ItemID": row['price'],
"ItemName": row['price'],
"Quantity": 1,
"Price": row['price'],
"Cost": 0,
"StatusID": 1,
"OrderDetailModifiers": [
{
"ModifierID": 0,
"ModifierName": row['price'],
"Quantity": 0,
"Price": 0,
"Cost": 0,
"StatusID": 1
},
{
"ModifierID": 0,
"ModifierName": row['price'],
"Quantity": 0,
"Price": 0,
"Cost": 0,
"StatusID": 1
}
]
}
}
);
amount += double.parse(row['price']);
print(amount);
print(row);
print(items);
});
Sorry I have added row['price']
at some places you can replace all of them by your need
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…