错误在 StudentAdd(List.. and _StudentAddState(Lİst.. in first and second class) 给出
错误两次对我说“必须初始化不可为空的实例字段‘学生’。”和 必须初始化不可为 null 的实例字段“students”。
我所有的代码:
class StudentAdd extends StatefulWidget {
List<Student> students;
StudentAdd(List<Student> students){
this.students = students;
}
@override
State<StatefulWidget> createState() {
return _StudentAddState(students);
}
}
class _StudentAddState extends State with StudentValidationMixin {
List<Student> students;
var student = Student.withInfo(0, '', '', 0);
var formKey = GlobalKey<FormState>();
_StudentAddState(List<Student> students){
this.students = students;
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text('Yeni Öğrenci Ekle'),
),
body: Container(
margin: EdgeInsets.all(20.0),
//margin: EdgeInsets.only(top: 20.0, right: 20.0, left: 20.0),
child: Form(
key: formKey,
child: Column(
children: <Widget>[
buildFirstNameField(),
buildLastNameField(),
buildGradeField(),
buildSubmitButton(),
],
),
),
),
);
}
相关文章:
python - 给定四边形的角,使用 matplotlib 在 3d 中绘制阴影四边形
apache-spark - 由于执行者丢失导致洗牌阶段失败
python - 将列名传递给 Pandas read_csv() 函数
react-native - 如何在 React Navigation 中使用图标代替原来的后退按钮
npm - sh : hardhat: command not found when install
angular - 如何配置 nginx 以在/和代理/api 上为另一个 api 服务器提供 An
python - PyTorch 中的 DataLoader 和 DataLoader2 有什么不同