0 purchases
text form field validator
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,
),
),
copied to clipboard
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
}
)
copied to clipboard
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.