Flutter 是否有可能在省道/颤振中创建一组对象
您好,我想知道是否有可能在dart/FLUTER中制作一组对象Flutter 是否有可能在省道/颤振中创建一组对象,flutter,dart,Flutter,Dart,您好,我想知道是否有可能在dart/FLUTER中制作一组对象 class Student { int math; } Student[] studentArray = new Student[7]; 学生阵列[0]=新学生 参见列表类-文档中说:具有长度的对象的可索引集合。Dart中的数组等效于使用构造函数创建的列表,该构造函数采用长度参数:Listlen。这与[]不同,前者是不可生长的,后者可以生长。谢谢,我会试试这个 void main() { List persons = [U
class Student {
int math;
}
Student[] studentArray = new
Student[7];
学生阵列[0]=新学生 参见列表类-文档中说:具有长度的对象的可索引集合。Dart中的数组等效于使用构造函数创建的列表,该构造函数采用长度参数:Listlen。这与[]不同,前者是不可生长的,后者可以生长。谢谢,我会试试这个
void main() {
List persons = [User("foo"), User("bar")]; //non-empty on create
List users = []; //blank initially
for (int i = 0; i < 5; i++) {
users.add("User $i");
}
//print using iterator
for (var u in users) {
print(u);
}
/*
* first element can be accessed using users[0] or users.first
* last element can be accessed using users.last
* */
}
class User {
String name;
User(this.name);
}