auto_validate
Auto Validateパッケージは、カスタマイズ可能な正規表現を使用して入力検証を簡素化し、さまざまなデータ形式の効率的な検証を可能にします。
dev-mahmoud-elshenawy/auto_validate open-source repository details.
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
The Auto Validate Package is a unique and easy-to-use solution for automatic validation of various data types using regular expressions.
This package streamlines the validation process, allowing you to easily implement validation without needing to write the code yourself. By using this package, you can save valuable time and ensure that your input data meets the required criteria.
Here's a simple example of how to use the Auto Validate package:
This package provides an extension on String? that offers convenient methods for validating various input formats using the AutoValidate class. It allows for a more readable and fluent validation process in your Dart applications.
String? instances.import 'package:auto_validate/auto_validate.dart';
void validation() {
var email = 'Dev.M.ElShenawy@Icloud.com';
var name = 'Mahmud El Shenawy';
var password = '@MahmoudElShenawy2021';
var phone = '+201098415860';
// You can validate the input using the AutoValidate class
AutoValidate.email(email.toString())
? print('Email is Valid')
: print('Email is Invalid');
AutoValidate.userName(name.toString())
? print('User Name is Valid')
: print('User Name is Invalid');
AutoValidate.password(password.toString())
? print('Password is Valid')
: print('Password is Invalid');
AutoValidate.phone(phone.toString())
? print('Phone is Valid')
: print('Phone is Invalid');
// You can also use the extension methods to validate the input
email.isValidEmail
? print('Email is Valid')
: print('Email is Invalid');
name.isValidUsername
? print('User Name is Valid')
: print('User Name is Invalid');
password.isValidPassword
? print('Password is Valid')
: print('Password is Invalid');
phone.isValidPhone
? print('Phone is Valid')
: print('Phone is Invalid');
}
A simple usage of Form Validator Example:
import 'package:auto_validate/auto_validate.dart';
TextFormField(
controller: emailController,
decoration: InputDecoration(
hintText: "Email",
border: OutlineInputBorder(
borderSide: BorderSide(),
),
),
validator: FormValidator.email(
errorMessage: 'Please Enter Valid Email',
),
);
Make validation on all next elements with AutoValidate
Make form validation on all next elements with FormValidator
import 'package:auto_validate/auto_validate.dart';
TextFormField(
controller: emailController,
decoration: InputDecoration(
hintText: "Password",
border: OutlineInputBorder(
borderSide: BorderSide(),
),
),
validator: FormValidator.combination(
validators: [
FormValidator.maxLength(maxLength: 15, errorMessage: 'Password Enter Valid Password With Max Length 15'),
FormValidator.minLength(minLength: 5, errorMessage: 'Password Enter Valid Password At Least Min Length 5'),
FormValidator.passwordStrong(errorMessage: 'Please Enter Valid Strong Password')
])
);
If you encounter any issues, bugs, or have suggestions for improvements, please report them on the GitHub Issues page.
When reporting an issue, please provide the following information:
Your feedback is invaluable for improving the package and helping others in the community!
This project is licensed under the MIT License - see the LICENSE file for details
依存関係一覧 3 件
{"sdk":"flutter"}^1.19.1{"sdk":"flutter"}用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗