首页 > 解决方案 > 关于飞镖上的地图功能

问题描述

这是我的代码,创建了一个类和这个类的列表。我尝试运行地图功能但无法正常工作。

class Student {
  int id;
  String firstName;
  String lastName;
  int point;
  Student({this.firstName, this.lastName, this.point});
  Student.withId({this.id, this.firstName, this.lastName, this.point});
}

void main() {
  List<Student> students = [
  Student.withId(id: 1, firstName: 'James', lastName: 'Red', point: 90),
  Student.withId(id: 2, firstName: 'Dougles', lastName: 'Brown', point: 90),
  Student.withId(id: 3, firstName: 'Jack', lastName: 'White', point: 90),
  ];
  students.map((student) {
    print(student.firstName);
  });

}

此代码没有输出。我有什么错。

标签: functiondictionarydart

解决方案


推荐阅读