Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 是否有可能在省道/颤振中创建一组对象_Flutter_Dart - Fatal编程技术网

Flutter 是否有可能在省道/颤振中创建一组对象

Flutter 是否有可能在省道/颤振中创建一组对象,flutter,dart,Flutter,Dart,您好,我想知道是否有可能在dart/FLUTER中制作一组对象 class Student { int math; } Student[] studentArray = new Student[7]; 学生阵列[0]=新学生 参见列表类-文档中说:具有长度的对象的可索引集合。Dart中的数组等效于使用构造函数创建的列表,该构造函数采用长度参数:Listlen。这与[]不同,前者是不可生长的,后者可以生长。谢谢,我会试试这个 void main() { List persons = [U

您好,我想知道是否有可能在dart/FLUTER中制作一组对象

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);
}