【发布时间】:2020-12-25 01:13:03
【问题描述】:
Flutter 如何显示数组的数组数据。
我的数据是这样的
I/flutter ( 7557): {count: 1,
records: [{
cnic: 42501-0978008-5,
name: abc
family_members: [{
gender: F,
name: Dua Batool,
age: 8,
relationship: Daughter
},
{
gender: M,
name: Shayan,
age: 9,
relationship: Son
}
]}]}
我需要做的是打印家庭成员数组的名称。
我的代码是这样的
Future<List> doSomeAsyncStuff() async {
final storage = new FlutterSecureStorage();
String value = await storage.read(key: 'Cnic');
print(value);
String url = 'http://api.igiinsurance.com.pk:8888/insurance_IgiGen/insurance-api/get_company_employee.php?offset=0&limit=1&cnic=${value}' ;
final msg = jsonEncode({"cnic": value});
Map<String,String> headers = {'Content-Type':'application/json'};
String token = value;
final response = await http.get(url);
var Data = json.decode(response.body);
print(Data);
}
它的打印数据值,正如我在问题的上方向您展示的那样,我需要打印家庭成员的姓名。我知道这是个愚蠢的问题,但我无法打印 Familymembers 数组的名称
【问题讨论】: