【问题标题】:Get the number of Items in a List获取列表中的项目数
【发布时间】:2020-05-22 19:30:28
【问题描述】:

飞镖有没有办法计算和获取列表中的项目数?那么,当你有一个包含五个单词的列表时,它会在调用该方法时输出数字 5?

【问题讨论】:

  • 使用list.length获取列表项的个数

标签: list flutter dart


【解决方案1】:

list_variable_name.length

Reference: Tutorialspoint

【讨论】:

    【解决方案2】:

    您只需获取列表变量并对其执行 .length 即可返回它的长度。

    https://api.dart.dev/stable/2.8.2/dart-core/List-class.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-14
      • 1970-01-01
      • 2011-08-21
      • 1970-01-01
      • 2013-04-29
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多