修改地图

时间:2019-04-11 15:47:24

标签: android json dart flutter

List<Map<String, dynamic>> httpResponse =[];需要将提取的列表修改为新列表。该列表是通过Http请求获取的,需要添加一个名为all_answer的密钥才能修改请求的列表并创建一个新的列表formatedRequest

结构:-

     {
      "category": "History",
      "type": "multiple",
      "difficulty": "hard",
      "question": "With which Greek philosopher",
      "correct_answer": "Socrates",
      "incorrect_answers": [
        "Aristotle",
        "Plato",
        "Pythagoras"
      ]
    },
{},
{},
....,
....,
]```
                       need to convert it to
```List<Map<String, dynamic>> formatedRequest =[];```

STRUCTURE:-

```[
     {
      "category": "History",
      "type": "multiple",
      "difficulty": "hard",
      "question": "With which Greek philosopher",
      "correct_answer": "Socrates",
      "incorrect_answers": [
        "Aristotle",
        "Plato",
        "Pythagoras"
      ],
      "all_answers":[
        "Aristotle",
        "Plato",
        "Pythagoras",
        "Socrates"

       ]
    },
{},
{},
....,
....,
]```

0 个答案:

没有答案