id_doc_kit 0.0.8 copy "id_doc_kit: ^0.0.8" to clipboard
id_doc_kit: ^0.0.8 copied to clipboard

Indian ID validation helpers for KYC and onboarding (Aadhaar, PAN, GSTIN, DL, Voter ID, Passport + PIN/Phone/Email).

id_doc_kit #

A lightweight, production-ready Flutter/Dart toolkit for validating
Indian ID documents with structured results and flexible form field support.

Perfect for KYC, onboarding, fintech, business verification, and identity apps.


๐Ÿš€ Live Demo #

Try it out in your browser! ๐Ÿ‘‰ View Live Demo

The demo showcases all supported document types with real-time validation feedback.


โœ… Supported Documents #

  • โœ… Aadhaar (with Verhoeff checksum)
  • โœ… PAN
  • โœ… Driving License (basic format)
  • โœ… GSTIN (basic structure + state code)
  • โœ… Voter ID (EPIC) โ€” 2โ€“3 letters + 7 digits
  • โœ… Passport (Indian) โ€” 1 letter + 7 digits
  • โœ… Phone number (India)
  • โœ… PIN code (India)
  • โœ… Email (basic format)

This makes id_doc_kit one of the most complete, developer-friendly Indian document validation packages on pub.dev.


โœจ Key Features #

  • โœ… Structured validation results

    • isValid
    • normalizedValue
    • errorCode (e.g. INVALID_FORMAT, INVALID_LENGTH, INVALID_CHECKSUM)
    • errorMessage (human-friendly)
  • โœ… Single unified validator API

    • IdValidator.instance.validate(type: ..., value: ...)
    • IdValidator.instance.validateAuto(value) (optional)
  • โœ… Three flexible ways to handle input fields

    • idFormFieldValidator โ†’ logic only
    • IdTextField โ†’ ready-to-use widget
    • IdField โ†’ fully custom UI via builder
  • ๐Ÿ”„ Consistent behavior across Aadhaar, PAN, DL, GSTIN, Voter ID, Passport

  • ๐Ÿšซ No external APIs (offline, fast, privacy-safe)

  • ๐ŸŒ Works on Android, iOS, Web

  • ๐Ÿงช Well-tested & null-safe


We validate driving licenses using a two-step approach:

  1. Comprehensive state-aware validation (DrivingLicenseStateValidator)
  • Validates: state code, RTO, year (1988..currentYear+1), serial.
  • Options: requiredState, strictMode, allowLegacyCodes.
  1. Fallback permissive validation
  • Applies a looser format (SS + RTO + YYYY + serial) only if comprehensive validation fails.
  • Important: fallback also validates the parsed year and serial to avoid false positives (error codes: DL_FALLBACK_YEAR_INVALID, DL_FALLBACK_SERIAL_INVALID).

Usage examples:

// Simple: package-level validator
final res = IdValidator.instance.validate(IdDocumentType.drivingLicense, 'KA0120210001234');
if (res.isValid) {
print('Normalized: ${res.normalizedValue}');
} else {
// show UI-friendly message
print(res.friendlyMessage);
}

// Strict mode (server-side)
final full = DrivingLicenseStateValidator.validate(
'OR0120150001234',
strictMode: true,
allowLegacyCodes: false,
);
if (!full.isValid) {
print(full.errorMessage);
}

Formatting & autoFormat #

id_doc_kit now includes IdFormatter for UI-friendly formatting and an autoFormat toggle on text fields.

IdFormatter #

Use to normalize/format values consistently in UI:

import 'package:id_doc_kit/id_doc_kit.dart';

final panFormatted = IdFormatter.format(IdDocumentType.pan, 'abcde1234f'); // ABCDE1234F
final aadhaarFormatted = IdFormatter.format(IdDocumentType.aadhaar, '123456789012'); // 1234 5678 9012

๐Ÿ“ฆ Installation #

Add this to your pubspec.yaml:

dependencies:
  id_doc_kit: ^0.0.8
2
likes
0
points
194
downloads

Publisher

unverified uploader

Weekly Downloads

Indian ID validation helpers for KYC and onboarding (Aadhaar, PAN, GSTIN, DL, Voter ID, Passport + PIN/Phone/Email).

Repository (GitHub)
View/report issues

Topics

#india #kyc #aadhaar #pan #gstin

License

unknown (license)

Dependencies

flutter

More

Packages that depend on id_doc_kit