【问题标题】:Expected a value of type 'int', but got one of type list<Map<string, dynamic>>需要一个“int”类型的值,但得到了 list<Map<string, dynamic>> 类型之一
【发布时间】:2021-11-02 02:32:31
【问题描述】:

我尝试将 listview.builder 显示为扩展的子项,但在 chrome 中显示此消息 “期望一个'int'类型的值,但在 Flutter 中得到了 list>”类型之一

【问题讨论】:

  • edit您的问题将相关代码包含为minimal reproducible example,以便我们为您提供帮助。
  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: flutter dart


【解决方案1】:

您申请的 itemCount 类型是什么?

  itemCount: entries.length

也许你在这里放错了变量类型。

尝试使用像list.length这样的int

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-12
    • 2021-11-15
    • 2021-11-12
    • 2021-07-13
    • 2020-12-03
    • 2021-12-27
    • 2021-05-02
    • 2021-07-29
    相关资源
    最近更新 更多