The errors are given at StudentAdd(List.. and _StudentAddState(Lİst.. in first and second class
Error is saying to me two times that 'Non-nullable instance field 'students' must be initialized.' and Non-nullable instance field 'students' must be initialized.
All my code :
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(),
],
),
),
),
);
}