Look below it might be help you
List<String> names = ["jsbc", "snjc", "scnj"];
List<String> quantity = ["1", "2", "3"];
List<String> type = ["wqew", "dcvd", "dw"];
Map<String, dynamic> test = Map();
for (var i = 0; i < names.length; i++) {
var data = {
"material[$i][name]": names[i],
"material[$i][quantity]": quantity[i],
"material[$i][type]": type[i]
};
test.addAll(data);
}
print(test);
Output:
{material[0][name]: jsbc, material[0][quantity]: 1, material[0][type]: wqew, material[1][name]: snjc, material[1][quantity]: 2, material[1][type]: dcvd, material[2][name]: scnj, material[2][quantity]: 3, material[2][type]: dw}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…