Skip to content

niamulhasan/text_form_field_validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (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

Additional information

If you want to contribute to the project please go to our github repo GitHub

About

A super simple dart function for validating text form field in dart and flutter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages