Auto Validate は、カスタマイズ可能な正規表現を使用して入力検証を簡素化するFlutterパッケージです。メールアドレス、電話番号、カスタムパターンなどのデータ形式を最小限のコードで効率的に検証できるようにします。フォームにスムーズに統合され、リアルタイムフィードバックを提供し、ボイラープレートの検証ロジックを削減します。クロスプラットフォーム対応で、Android、iOS、Web、macOS、Windows、Linuxをサポートしており、さまざまな環境での一貫した検証に最適です。
The Auto Validate Package is a unique and easy-to-use solution for automatic validation of various data types using regular expressions.
Importance
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.
Usage
Here's a simple example of how to use the Auto Validate package:
String Validation Extension [New Feature]
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.
Features
Validate usernames, passwords, email addresses, phone numbers, credit card numbers, and more.
Check for valid formats like ISBN, MAC addresses, hexadecimal codes, and JSON Web Tokens (JWT).
Simplify validation checks by using fluent methods directly on String? instances.
Improve code readability and maintainability by using the extension methods for validation.
import'package:auto_validate/auto_validate.dart';
voidvalidation() {
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 classAutoValidate.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');
}