通过此API
List customerItems = await _helper.get('/Customers/v1/GetItems/$cid/$pfType/$targetId');
var groupByCustomerItems = groupBy(customerItems, (obj) => obj['itemtype']).map((key, value) => MapEntry(
key,
value.map((item) {
return new CustomerItem.fromJson(item);
}).toList()));我得到的结果如下:
{Device: [Instance of 'CustomerItem', Instance of 'CustomerItem'], Dial-Up: [Instance of
'CustomerItem', Instance of 'CustomerItem'], Domain: [Instance of 'CustomerItem'], EMAIL:
[Instance of 'CustomerItem', Instance of 'CustomerItem', Instance of 'CustomerItem',
Instance of 'CustomerItem', Instance of 'CustomerItem', Instance of 'CustomerItem', Instance
of 'CustomerItem', Instance of 'CustomerItem', Instance of 'CustomerItem', Instance of
'CustomerItem', Instance of 'CustomerItem', Instance of 'CustomerItem', Instance of
'CustomerItem', Instance of 'CustomerItem', Instance of 'CustomerItem'], HSI: [Instance of
'CustomerItem'], vo.phone: [Instance of 'CustomerItem', Instance of 'CustomerItem', Instance
of 'CustomerItem', Instance of 'CustomerItem', Instance of 'CustomerItem', Instance of
'CustomerItem', Instance of 'CustomerItem', Instance of 'CustomerItem', Instance of
'CustomerItem']}它是按类型分组的CustomerItems列表。方法的返回类型是什么?
Future<List<CustomerItem>>似乎是不正确的。感谢您的帮助和建议。
发布于 2020-04-02 21:15:53
这是一张地图Map<String, List<CustomerItem>>
发布于 2020-04-02 21:27:10
应为Map<String, List<CustomerItem>>
https://stackoverflow.com/questions/60992080
复制相似问题