【问题标题】:What is difference between List.from and List.add [duplicate]List.from 和 List.add 有什么区别 [重复]
【发布时间】:2021-10-19 01:26:16
【问题描述】:

先生,我正在研究颤振。我想知道这两种代码的区别。

points = List.add(DrawingArea(
                                  point: details.localPosition,
                                  areaPaint: Paint()
                                    ..strokeCap = StrokeCap.round
                                    ..blendMode = BlendMode.clear
                                    ..color = Colors.transparent
                                    ..isAntiAlias = true
                                    ..strokeWidth = strokeWidth))

points = List.from(points)..add(DrawingArea(
                                  point: details.localPosition,
                                  areaPaint: Paint()
                                    ..strokeCap = StrokeCap.round
                                    ..blendMode = BlendMode.clear
                                    ..color = Colors.transparent
                                    ..isAntiAlias = true
                                    ..strokeWidth = strokeWidth))

【问题讨论】:

    标签: list flutter


    【解决方案1】:

    List.add 添加单个条目,List.from 从另一个列表创建一个列表(多个条目)

    【讨论】:

      猜你喜欢
      • 2020-05-18
      • 2018-02-06
      • 2018-10-23
      • 1970-01-01
      • 2017-02-17
      • 2011-09-27
      • 2013-04-22
      • 2012-03-29
      • 1970-01-01
      相关资源
      最近更新 更多