function - 关于飞镖上的地图功能
问题描述
这是我的代码,创建了一个类和这个类的列表。我尝试运行地图功能但无法正常工作。
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);
});
}
此代码没有输出。我有什么错。
解决方案
推荐阅读
- package.json - 运行 npm 版本补丁后使 Bitbucket 管道使用新的 package.json 版本
- c++ - 我的程序正在退出,返回值 3221225620
- assembly - 在用汇编编写的程序中添加两个数字时得到意外结果
- database - 在颤振中使用 MultipartFile 发送许多带有 id foreach 项目的图像
- javascript - 如何在反应中从数组中删除元素?
- github - 在某个拉取请求之后搜索查询以获取所有合并的拉取请求
- regex - Kotlin 正则表达式没有匹配
- c++ - 使用垃圾值(非初始化值)作为 id
- bert-language-model - 词汇大小必须精确计算 bert_config.json 中的 vocab_size 吗?
- amazon-web-services - Dockerfile 在本地工作正常,但在 CircleCI 中不能工作