【问题标题】:How to print items of list without braces in dart?如何在飞镖中打印没有大括号的列表项?
【发布时间】:2020-02-20 15:30:24
【问题描述】:

我是飞镖的初学者,我想打印多维数组的最后一项。

for 循环代码给出了什么:
[[项目1],[项目1,项目2]]

我要打印的是最后一个列表项,例如:
Item1, Item2

我尝试过 for 循环,但我失败了 请帮帮我

【问题讨论】:

    标签: arrays list flutter dart printing


    【解决方案1】:

    试试这个:

     [[Item1], [Item1, Item2]].forEach((list) {
       print(list.last);
     });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-02-19
      • 2015-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多