text_form_field_validator 0.0.3 text_form_field_validator: ^0.0.3 copied to clipboard
A super simple dart function for validating text form field in dart and flutter.
A super simple dart function for validating text form field in dart and flutter.
Features #
- Provides a super simple function for text validation.
Getting started #
No extra dependency is required. Just install the package and you are ready to go.
Usage #
The provided FormValidator.validate() function is created to be used as the validator of the TextFormField()
Usage: TextFormField(validator: (value) => FormValidator.validate(value))
to /example
folder.
Example:
TextFormField(
validator: (value) => FormValidator.validate(
value,
required: true,
stringFormat: StringFormat.url,
),
),
validate()
is the only method that validate the text.
Parameters of validate()
#
Example with all parameters
FormValidator.validate(
data, {
required: true,
min: 0,
max: 20,
match: "match with this string"
regex: RegExp(r'\d+'),
stringFormat: StringFormat.email
}
)
Parameter's description
String data
required positional
required: true | false
min: int
max: int
match: String
regex: RegExp
stringFormat: enum StringFormat.email | StringFormat.url | StringFormat.numbers
Additional information #
If you want to contribute to the project please go to our github repo GitHub