I am beginner in Dart. Following is an array and I need to access a specific element
'text': 'Rabbit'and 'score': 3
I tried the below:
_questions[1]['answers'][0]['text']['score']
This doesn't work.
var _questions = [
{
'question': 'What is your color?',
'answers': [
{'text': 'Black', 'score': 10},
{'text': 'Red', 'score': 5},
{'text': 'Green', 'score': 3},
{'text': 'White', 'score': 1},
],
},
{
'question': 'What is your animal?',
'answers': [
{'text': 'Rabbit', 'score': 3},
{'text': 'Snake', 'score': 11},
{'text': 'Elephant', 'score': 5},
{'text': 'Lion', 'score': 9},
],
},
];