如何将动态的可选命名参数传递给flutter中的数组?

问题描述 投票:0回答:1

我正在尝试创建动态列表,是否可以像这样在其中传递动态可选的命名参数?

    List<dynamic> rtnListIndex = [{rtnListVal}];

  dynamic rtnListVal(int index, {
    String name,
    int tenthMin,
    int min,
    int tenthSec,
    int sec,
    int reps,
    double interval,
    int sets,
    int rest,
    int totalMin,
    int totalSec,
    int type,
    int prep,
  }) {
    return [index = 0, {name, tenthMin, min, tenthSec, sec, reps, interval, sets, rest, totalMin, totalSec, type, prep}];
  }

enter image description here

arrays flutter dynamic parameters named
1个回答
0
投票

要回答您的问题,不能将dart中的列表传递给可选参数,因为list方法的唯一参数是指定长度,并且已经是可选的。有关飞镖here中列表的更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.