'Get Nested List value and add it to button text

I'm new to flutter I've Created a nested list with questions and answers like this

  var questions = [
    {
      'question': '1+1',
      'answer': [
        {'text': 2,'correct':1},
        {'text': 3,'correct':0},
        {'text': 4,'correct':0},
        {'text': 5,'correct':0}
      ]
    },
    {
      'question': '1+4',
      'answer': [
        {'text': 2,'correct':0},
        {'text': 3,'correct':0},
        {'text': 4,'correct':0},
        {'text': 5,'correct':1}
      ]
    },
    {
      'question': '1+7',
      'answer': [
        {'text': 7,'correct':0},
        {'text': 8,'correct':1},
        {'text': 9,'correct':0},
        {'text': 10,'correct':0}
      ]
    },
  ];

Now I want to get the value of answer[0] or answer1 and add that value to the RaisedButton text Or even if it's a possibility to use for loop to generate a button for each answer

Thanks in advance.

I've tried

for ( var i in questions ) RaisedButton(onPressed: (){},child: Text((i['answer'].toString())),)

but I get it like this

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source