Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.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
Flutter 有没有一种方法可以从flifter中的单个JSON创建单独的多个列表?_Flutter - Fatal编程技术网

Flutter 有没有一种方法可以从flifter中的单个JSON创建单独的多个列表?

Flutter 有没有一种方法可以从flifter中的单个JSON创建单独的多个列表?,flutter,Flutter,下面是我从服务器获取的JSON。现在,我必须基于docgroup创建一个单独的列表。假设docgroup有两个相同的PAN卡值。因此,我必须创建一个docgroup列表,该列表的值为PAN Card。所以我真正想要的是,首先我们必须检查以找到类似的docgroup值,并创建一个列表。 先谢谢你 [ { "name": "Upload front side", "information": "Should m

下面是我从服务器获取的JSON。现在,我必须基于
docgroup
创建一个单独的列表。假设
docgroup
有两个相同的PAN卡值。因此,我必须创建一个
docgroup
列表,该列表的值为PAN Card。所以我真正想要的是,首先我们必须检查以找到类似的
docgroup
值,并创建一个列表。 先谢谢你

[
  {
    "name": "Upload front side",
    "information": "Should match PAN no. mentioned on IEC copy and self attested",
    "docgroup": "PAN Card",
    "status": "Active",
    "requiredStatus": 0,
    "stage": 1,
    "type": 0,
    "extension": "string",
    "createdBy": 0,
    "createdAt": "2021-06-08 04:46:00.822",
    "lastupdatedBy": 0,
    "lastUpdatedAt": "2021-06-08 04:46:00.822",
    "id": 1,
    "countryId": 1
  },
  {
    "name": "Upload back side",
    "information": "Should match PAN no. mentioned on IEC copy and self attested",
    "docgroup": "PAN Card",
    "status": "Active",
    "requiredStatus": 0,
    "stage": 1,
    "type": 0,
    "extension": "string",
    "createdBy": 0,
    "createdAt": "2021-06-08 04:46:00.822",
    "lastupdatedBy": 0,
    "lastUpdatedAt": "2021-06-08 04:46:00.822",
    "id": 2,
    "countryId": 1
  },
  {
    "name": "Upload IEC copy",
    "information": "Please upload IEC copy (self attested)",
    "docgroup": "IEC Copy",
    "status": "Active",
    "requiredStatus": 0,
    "stage": 1,
    "type": 0,
    "extension": "string",
    "createdBy": 0,
    "createdAt": "2021-06-08 04:46:00.822",
    "lastupdatedBy": 0,
    "lastUpdatedAt": "2021-06-08 04:46:00.822",
    "id": 3,
    "countryId": 1
  },
  {
    "name": "Upload address proof",
    "information": "Please upload latest electricity bill/ telephone bill (any 1)",
    "docgroup": "Office address proof",
    "status": "Active",
    "requiredStatus": 0,
    "stage": 1,
    "type": 0,
    "extension": "string",
    "createdBy": 0,
    "createdAt": "2021-06-08 04:46:00.822",
    "lastupdatedBy": 0,
    "lastUpdatedAt": "2021-06-08 04:46:00.822",
    "id": 4,
    "countryId": 1
  }
]

您可以使用
List.where()
根据某些条件对列表进行分组/筛选

对于你的情况,看看这个

List panCardList=jsonList.where((json)=>json['docgroup']=='PAN Card');
List otherCardList=jsonList.where((json)=>json['docgroup']!='PAN Card');