【发布时间】:2020-11-09 05:59:31
【问题描述】:
我正在尝试从我的可迭代对象中创建一个列表,但它会引发以下错误
发生了异常。 ArgumentError(无效参数(输入): 不能为空)
关于toList()的
List<ContactModel> iterable = (await pluginContactService.ContactsService.getContacts(withThumbnails: false))
.where((contact) => contact.phones.firstWhere((item) => item.label == 'mobile', orElse: () => null)?.value != null)
.map((contact) => ContactModel(
contact.displayName, contact.phones.firstWhere((item) => item.label == 'mobile').value)).toList(growable: false);
它一遍又一遍地重复这个异常。如果我关闭异常,我会返回一个包含预期结果的列表。我该怎么办?
【问题讨论】:
-
要显示代码时最好使用代码而不是图像。
-
更新了@JerryZhou的问题
-
行号,字符号?指出显示问题的输出到底在哪里
-
异常出现在 .toList(growable: false);最后
标签: list flutter dart iterable