class StudentValidationMixin {
String validateFirstName(String value) {
if(value.length<2){
return 'İsim en az iki karakter olmalıdır';
}
}
}
The body might complete normally, causing 'null' to be returned, but the return type is a potentially non-nullable type.
class _StudentAddState extends State with StudentValidationMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Yeni öğrenci ekle"),
),
body: Container(
margin: EdgeInsets.all(20.0),
child: Form(
child: Column(
children: <Widget>[
TextFormField(
decoration: InputDecoration(labelText: "Öğrenci Adı", hintText: "Fatih"),
validator: validateFirstName,
),
],
),
),
),
);
}
}
The argument type 'String Function(String)' can't be assigned to the parameter type 'String? Function(String?)?'.
These two separate bits of code are getting an error. What should I do?