Auto Validate는 사용자 정의 가능한 정규 표현식을 사용하여 입력 검증을 단순화하는 플러터 패키지입니다. 이는 이메일, 전화번호, 사용자 지정 패턴 등의 데이터 형식을 최소한의 코드로 효율적으로 확인할 수 있도록 도와줍니다. 폼에 원활하게 통합되어 실시간 피드백을 제공하며, 반복적인 검증 로직을 줄여줍니다. 크로스플랫폼 사용을 위해 설계되었으며, Android, iOS, Web, macOS, Windows, Linux를 지원하여 다양한 환경에서 일관된 검증을 가능하게 합니다.
사용 사례
폼 입력 검증
실시간 사용자 피드백
이메일 및 전화번호 검증
사용자 정의 패턴 매칭
크로스 플랫폼 앱
검증 보일러플레이트 줄이기
주요 기능
사용자 정의 가능한 정규 표현식 패턴
실시간 검증
크로스 플랫폼 지원
최소 설정
TextFormField와의 통합
유연한 오류 처리
적합한 대상
양식을 개발하는 개발자
엄격한 입력 검증이 필요한 앱
코드 간결성을 우선시하는 팀
다중 플랫폼을 대상으로 하는 프로젝트
프론트엔드 중심의 플러터 애플리케이션
고려 사항
정규 표현식 구문에 대한 이해 필요
오류 메시지에 추가 스타일링이 필요할 수 있습니다
복잡한 비즈니스 로직 검증에 적합하지 않습니다
정규 표현식을 초과하는 내장 검증기는 제한적입니다
정확성을 위해 적절한 정규 표현식 설계에 달려 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Auto Validate
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');
}