A super simple dart function for validating text form field in dart and flutter.
- Provides a super simple function for text validation.
No extra dependency is required. Just install the package and you are ready to go.
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.
TextFormField(
validator: (value) => FormValidator.validate(
value,
required: true,
stringFormat: StringFormat.url,
),
),
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 (This is the actual input data which will be validated)
required: true | false
min: int
max: int
match: String
regex: RegExp
stringFormat: enum StringFormat.email | StringFormat.url | StringFormat.numbers
If you want to contribute to the project please go to our github repo GitHub