如何将两个单独的列表合并到对象列表中

How to Combine Two Seperate List in To List of Object

如何在Fluter,dart中将两个Separate List转换为Object List

class Task {

String name;
bool isDone
Task({this.name,this.isDone = false});

}

如何将这两个列表转换为如下所述的列表

List<String> taskname = ['buy  milk','go to school','go to gym'];
List<bool> taskname = [true,false,true];

我想这样转换

List<Task>  taskList = [

Task(name: 'buy milk',isDone : true),
Task(name: 'go to school',isDone : false),
Task(name: 'buy milk',isDone : true),

];

尝试:

var taskList = [for (var i = 0; i < taskname.length; i++) 
  Task(name: taskname[i], isDone: taskdone[i])
];