我正在尝试创建动态列表,是否可以像这样在其中传递动态可选的命名参数?
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}];
}
要回答您的问题,不能将dart中的列表传递给可选参数,因为list方法的唯一参数是指定长度,并且已经是可选的。有关飞镖here中列表的更多信息。