Closed Turkmen48 closed 2 years ago
I think I know what's going on. String is immutable object. So, when you do repeatPassword(controller.value)
it passes the actual value instead of reference to the value, meaning it will check password against initial value (probably empty string).
To fix it I would suggest passing TextEdigintController instead like:
extension CustomValidationBuilderRepeatPassword on ValidationBuilder {
///check if password repeated
///if password is not repeated return error message
repeatPassword(TextEditingController password) => add((value) {
if (value == null || value.isEmpty) {
return "Bu alan gereklidir";
}
if (value != password.value) {
return 'Şifreler eşleşmiyor!';
}
return null;
});
}
thank you so much. It worked.
Is your feature request related to a problem? Please describe. I dont know if is possible but i tried to Passing the data in the text editing controller to the validation builder (my custom validation builder extension) but it doesnt work.
Describe the solution you'd like I want to send the string data I got from the password controller to custom Validator Builder. When I tested it I noticed that, string data in the text editing controller does not reach the validation builder. But then when I try to access it with the regular button, the text editing controller works fine.
Additional context
Text Form Field codes:
This part of my codes is kept in another file called consts.dart.