List 如何从列表中的映射中提取值?
我有一个包含引号的列表,但该列表包含地图。我应该如何从下面给出的列表中访问author和text的值List 如何从列表中的映射中提取值?,list,flutter,dictionary,dart,List,Flutter,Dictionary,Dart,我有一个包含引号的列表,但该列表包含地图。我应该如何从下面给出的列表中访问author和text的值 List quotes = [ { "author": "Abraham Lincoln", "text": "A house divided against itself cannot stand." }, { "auth
List quotes = [
{
"author": "Abraham Lincoln",
"text": "A house divided against itself cannot stand."
},
{
"author": "Abraham Lincoln",
"text": "Important principles may, and must, be inflexible."
},
{
"author": "Abraham Lincoln",
"text": "I destroy my enemies when I make them my friends."
},
{
"author": "Abraham Lincoln",
"text":
"You have to do your own growing no matter how tall your grandfather was."
}]
您可以通过非常简单的方式访问这些值:
quotes[index]["text"]
quotes[index]["author"]
这里的索引将是一个类似于0,1,2的整数。。因为它告诉列表它必须访问哪个地图
如果你还是不明白
quotes[0]["text"]
我将给你第一句话,即“一座自相分裂的房子是站不住的。”