【问题标题】:How to fix "The argument type 'Future<int>' can't be assigned to the parameter type 'int'" in Flutter如何修复 Flutter 中的“参数类型 'Future<int>' 无法分配给参数类型 'int'”
【发布时间】:2020-09-09 00:54:56
【问题描述】:

我正在返回表中的行数并尝试将其用作列表视图构建器中的 itemCount。但 listview builder 显示此错误

The argument type 'Future<int>' can't be assigned to the parameter type 'int'

如何解决?

【问题讨论】:

  • 请发布代码 sn-p 以便人们能够为您提供帮助 @Shahbaz

标签: listview flutter dart future


【解决方案1】:

将方法的返回类型更改为 Future 而不是 int。

【讨论】:

    猜你喜欢
    • 2020-12-03
    • 2021-07-20
    • 2022-07-26
    • 2021-09-24
    • 1970-01-01
    • 1970-01-01
    • 2019-09-23
    • 2023-01-13
    • 2020-10-22
    相关资源
    最近更新 更多