首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Flutter什么是正确的返回方法类型?

Flutter什么是正确的返回方法类型?
EN

Stack Overflow用户
提问于 2020-04-02 20:55:08
回答 2查看 32关注 0票数 0

通过此API

代码语言:javascript
复制
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()));

我得到的结果如下:

代码语言:javascript
复制
{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列表。方法的返回类型是什么?

代码语言:javascript
复制
Future<List<CustomerItem>>

似乎是不正确的。感谢您的帮助和建议。

EN

回答 2

Stack Overflow用户

发布于 2020-04-02 21:15:53

这是一张地图Map<String, List<CustomerItem>>

票数 1
EN

Stack Overflow用户

发布于 2020-04-02 21:27:10

应为Map<String, List<CustomerItem>>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60992080

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档