Я новичок во флаттере. Я создал вложенный список с вопросами и ответами, подобными этому
var questions = [
{
'question': '1+1',
'answer': [
{'text': 2,'correct':1},
{'text': 3,'correct':0},
{'text': 4,'correct':0},
{'text': 5,'correct':0}
]
},
{
'question': '1+2',
'answer': [
{'text': 2,'correct':0},
{'text': 3,'correct':1},
{'text': 4,'correct':0},
{'text': 5,'correct':0}
]
},
{
'question': '1+3',
'answer': [
{'text': 2,'correct':0},
{'text': 3,'correct':0},
{'text': 4,'correct':1},
{'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+6',
'answer': [
{'text': 7,'correct':1},
{'text': 8,'correct':0},
{'text': 9,'correct':0},
{'text': 10,'correct':0}
]
},
{
'question': '1+6',
'answer': [
{'text': 7,'correct':1},
{'text': 8,'correct':0},
{'text': 9,'correct':0},
{'text': 10,'correct':0}
]
}, {
'question': '1+7',
'answer': [
{'text': 7,'correct':0},
{'text': 8,'correct':1},
{'text': 9,'correct':0},
{'text': 10,'correct':0}
]
},
];
Теперь я хочу получить значение ответа [0] или ответа 1 и добавьте это значение к тексту RaisedButton. Или даже если возможно использовать l oop для создания кнопки для каждого ответа
Заранее спасибо.
Я пробовал
for ( var i in questions ) RaisedButton(onPressed: (){},child: Text((i['answer'].toString())),)
но я так понимаю 