uz_document_validator
O'zbekiston hujjatlari uchun Flutter/Dart validator va formatter paketi.
Features
| Hujjat | Validatsiya | Formatlash | Ma'lumot chiqarish |
|---|---|---|---|
| PINFL/JSHSHIR | ✅ | ✅ | ✅ (tug'ilgan sana, jins, hudud) |
| Pasport | ✅ | ✅ | — |
| INN/STIR | ✅ | — | — |
| Telefon | ✅ | ✅ | ✅ (operator) |
| Avtomobil raqami | ✅ | — | — |
Installation
dependencies:
uz_document_validator: ^0.1.0
Usage
PINFL validatsiya
import 'package:uz_document_validator/uz_document_validator.dart';
// Oddiy tekshirish
bool valid = UzValidator.isPinflValid('30101990123458');
// Batafsil natija
ValidationResult result = UzValidator.pinfl('30101990123458');
print(result.isValid); // true/false
print(result.errorMessage); // xato bo'lsa xabar
// Ma'lumot chiqarish
PinflInfo? info = UzValidator.parsePinfl('30101990123458');
print(info?.gender); // 'male' yoki 'female'
print(info?.birthDate); // DateTime
print(info?.regionCode); // hudud kodi
print(info?.century); // '1800s' | '1900s' | '2000s'
Pasport validatsiya
ValidationResult result = UzValidator.passport('AA1234567');
String? formatted = UzValidator.formatPassport('AA1234567'); // 'AA 1234567'
INN / STIR validatsiya
ValidationResult result = UzValidator.inn('123456789');
print(result.isValid); // true
Telefon validatsiya
ValidationResult result = UzValidator.phone('+998901234567');
String? operator = UzValidator.getPhoneOperator('+998901234567'); // 'Beeline'
Avtomobil raqami
bool valid = UzValidator.isLicensePlateValid('01A123BC');
TextInputFormatter (Flutter)
TextField(
inputFormatters: [UzPhoneFormatter()],
// Avtomatik format: +998 90 123 45 67
)
TextField(
inputFormatters: [PinflFormatter()],
// Faqat 14 ta raqam qabul qiladi
)
TextField(
inputFormatters: [PassportFormatter()],
// Avtomatik format: AA 1234567
)
Form validation
TextFormField(
validator: (value) {
final result = UzValidator.pinfl(value ?? '');
return result.isValid ? null : result.errorMessage;
},
)
PINFL tuzilishi
PINFL (JSHSHIR) — 14 raqamli O'zbekiston shaxsiy identifikatsiya raqami.
| Pozitsiya | Tavsif |
|---|---|
| 1 | Jins + asr kodi (1-6) |
| 2-3 | Kun (01-31) |
| 4-5 | Oy (01-12) |
| 6-7 | Yilning oxirgi 2 raqami |
| 8-10 | Hudud kodi |
| 11-13 | Tartib raqami |
| 14 | Checksum |
Birinchi raqam kodlari:
1— erkak, 2000-20992— ayol, 2000-20993— erkak, 1900-19994— ayol, 1900-19995— erkak, 1800-18996— ayol, 1800-1899
License
MIT