strings_validator 0.1.4
A new Flutter package for validate strings in custom format you choose.You can pass your params to the validate method and method returns null or err as result
This package is a validation package which helps you to validate strings.If the string has correct format the validate method returns null and if string does not match to what you like validate method returns error message.
Features
verity options:
1-min length
2-max length
3-required (not empty)
4-is number
5-is alphabet
6-is email
7-contains a upperCase
8-contains a special characters
Getting started
For using this package you just to need add it to your pubspec.yaml file.
strings_validator :last versionAfter that import it where ever you want to use it.
import 'package:strings_validator/validation/validation.dart';
And finally call validate method on each string you are trying to validate.This method has two param first one is what option you want and second one is a map of message which you want to will be overrode
Usage
options are:
1-max:32-min:2
3-required
4-number
5-alpha
6-email
7-upperCase
8-specialChar
String test = 'this is your string';
const String pattern = 'min:6|max:12|email|required';
Map<String,String> MyMessages= {
'max':'max length of your input should be 12 char',
'min':'min length of your input should be 6 char',
'email':'your input is not a email and its format is incorrect'
};
String? result= test.validate(pattern,messages:MyMessages);
print(result); //if string will be matched demonstrates null else demonstrates error message
Additional information
You can contribute on github https://github.com/mjdarvishi