id_doc_kit

A lightweight, production-ready Flutter/Dart package for validating Indian ID documents used in KYC, onboarding, and fintech workflows.

Built with a strict core architecture, structured results, and UI-friendly helpers.

๐Ÿš€ 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

โœ… PAN

โœ… GSTIN

โœ… Driving License (strict + fallback)

โœ… Voter ID (EPIC)

โœ… Passport

โœ… PIN Code (India)

โœ… Phone Number (India)

โœ… Email

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


โœจ Key Features

  • โœ… Structured Validation Results:
IdDocumentResult {
  type,
  rawValue,
  normalizedValue,
  isValid,
  errorCode,
  errorMessage,
  confidence,
  meta
}

๐Ÿง  Confidence Score (NEW)

Each validation result includes a confidence score (0.0 โ†’ 1.0) indicating structural certainty.


Scenario Confidence
Strict deterministic validation (PAN, Aadhaar, Passport) 1.0
Strong structure, no checksum (GSTIN, Phone, Email, PIN) 0.9 โ€“ 0.95
Driving License fallback validation 0.6
Invalid 0.0

โš ๏ธ Important:

Confidence represents structural validation only. This package does NOT verify documents against government databases.


๐Ÿงฉ Metadata (meta) for Advanced Use Cases

Validators expose parsed data via the meta field.

Example (Driving License):

meta: {
  "stateCode": "KA",
  "stateName": "Karnataka",
  "rto": "01",
  "year": 2021,
  "serial": "0001234",
  "isLegacy": false,
  "isFallback": false
}

๐Ÿชช Driving License Validation (Important)

Driving Licenses are validated in two stages:

1๏ธโƒฃ Strict Validation (Preferred)

  • Validates state/UT code
  • RTO range
  • Year bounds
  • Legacy handling
  • Returns confidence = 1.0

2๏ธโƒฃ Fallback Validation

  • Structural format match only
  • Used when strict validation fails
  • Returns confidence = 0.6
  • Clearly marked via meta.isFallback = true

This ensures maximum compatibility with real-world data while maintaining transparency.

๐Ÿงช Example Usage

final result = IdValidator.instance.validate(
  type: IdDocumentType.pan,
  value: 'ABCDE1234F',
);

if (result.isValid && result.confidence >= 0.9) {
  // Safe to proceed
}

๐ŸŽจ UI-Friendly Widgets

Quick integration:

IdTextField(
  type: IdDocumentType.pan,
  onValidationChanged: (isValid) {},
);

Full control:

IdField(
  type: IdDocumentType.aadhaar,
  builder: (context, controller, result) {
    return TextField(
      controller: controller,
      decoration: InputDecoration(
        errorText: result?.errorMessage,
      ),
    );
  },
);

๐Ÿง  Design Principles

  • No standalone functions
  • Single validation entry point
  • Strict base architecture
  • No backend calls
  • No UI assumptions
  • Fully testable

๐Ÿ“Œ Use Cases

  • KYC onboarding
  • Fintech apps
  • Identity verification
  • Form validation
  • Government document input

๐Ÿ” Disclaimer

This package performs format and structural validation only. It does not confirm document ownership or authenticity with issuing authorities.

โ˜• Support & Sponsorship

If id_doc_kit saves you development time or helps in production, consider supporting its development.

Buy Me a Coffee

Your support helps maintain accuracy, documentation, and long-term maintenance.

Libraries

id_doc_kit