suppose my list 1 data is like this
[
{
key1: value1,
key2: value2,
key3: value3,
},
{
key1: value4,
key2: value5,
key3: value6,
},
.....
]
what if i want to send
{
key1: value4,
key2: value5,
key3: value6,
},
to updatedList at index 1
my code is:
updatedList[0]= List.from(widget.allDataList[1]);
CodePudding user response:
void main() {
var list = [];
list =
[
{
"key1": "value1",
"key2": "value2",
"key3": "value3",
},
{
"key1": "value4",
"key2": "value5",
"key3": "value6",
},
];
List<Map<String, String>> updatedList=[];
updatedList.insert(0, list[0]);
print(updatedList);
}