I got stuck with an error can anyone help me to solve this "This function has a return type of 'String' but doesn't end with a return statement. Try adding a return statement, or changing the return type to 'void'.",
Under value it is underlined with the blue line(showing error)
TextFormField(
decoration: InputDecoration(labelText: 'E-Mail'),
keyboardType: TextInputType.emailAddress,
validator: (value) {
if (value.isEmpty || !value.contains('@')) {
return 'Invalid email!';
}
},
onSaved: (value) {
_authData['email'] = value;
},
),
You forgot to return null
code snippet
validator: (value) {
if (value.isEmpty || !value.contains('@')) {
return 'Invalid email!';
}
return null;
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With