Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
List 如何从列表中的映射中提取值?_List_Flutter_Dictionary_Dart - Fatal编程技术网

List 如何从列表中的映射中提取值?

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

我有一个包含引号的列表,但该列表包含地图。我应该如何从下面给出的列表中访问author和text的值

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"] 
我将给你第一句话,即“一座自相分裂的房子是站不住的。”