create a validator in flutter
TextFormField( // The validator receives the text that the user has entered. validator: (value) { if (value.isEmpty) { return 'Please enter some text'; } return null; }, );
create a validator in flutter
TextFormField( // The validator receives the text that the user has entered. validator: (value) { if (value.isEmpty) { return 'Please enter some text'; } return null; }, );
validator flutter
final passwordValidator = MultiValidator([ RequiredValidator(errorText: 'password is required'), MinLengthValidator(8, errorText: 'password must be at least 8 digits long'), PatternValidator(r'(?=.*?[#?!@$%^&*-])', errorText: 'passwords must have at least one special character') ]); String password; Form( key: _formKey, child: Column(children: [ TextFormField( obscureText: true, onChanged: (val) => password = val, // assign the the multi validator to the TextFormField validator validator: passwordValidator, ), // using the match validator to confirm password TextFormField( validator: (val) => MatchValidator(errorText: 'passwords do not match').validateMatch(val, password), ) ]), );
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us