national_code_validator 1.0.0

SDKdartflutter
Platformandroidioswindowslinuxmacosweb

A Dart library for validating Iranian National Code (کد ملی). This package implements the official validation algorithm for Iranian National Code with proper checks for length, format, and control digit.

National Code Validator | کد ملی اعتبارسنج | Nationale Code-Validator

A Dart library for validating Iranian National Code (کد ملی) with support for multiple languages.

🇬🇧 English

A Dart library for validating Iranian National Code (کد ملی).

Features

  • Validates the format and mathematical algorithm of Iranian National Code
  • Checks for exact 10-digit length
  • Verifies the control digit
  • Prevents common invalid patterns (like repeated digits)
  • Supports multiple languages (English, German, Persian)

Usage

import 'package:national_code_validator/national_code_validator.dart';

void main() {
  String nationalCode = "0499370899"; // Example valid national code
  bool isValid = NationalCodeValidator.isValid(nationalCode);
  print(isValid); // Returns true or false
}

Installation

Add the following to your pubspec.yaml:

dependencies:
  national_code_validator: ^1.0.0

🇩🇪 Deutsch

Eine Dart-Bibliothek zur Validierung des iranischen Nationalkodes (کد ملی).

Funktionen

  • Validiert das Format und den mathematischen Algorithmus des iranischen Nationalkodes
  • Überprüft die genaue 10-stellige Länge
  • Verifiziert die Kontrollziffer
  • Verhindert häufige ungültige Muster (wie wiederholte Ziffern)
  • Unterstützt mehrere Sprachen (Englisch, Deutsch, Persisch)

Verwendung

import 'package:national_code_validator/national_code_validator.dart';

void main() {
  String nationalCode = "0499370899"; // Beispiel für einen gültigen Nationalkode
  bool isValid = NationalCodeValidator.isValid(nationalCode);
  print(isValid); // Gibt true oder false zurück
}

🇮🇷 فارسی

یک کتابخانه Dart برای اعتبارسنجی کد ملی ایرانی.

ویژگی‌ها

  • بررسی فرمت و الگوریتم ریاضی کد ملی ایرانی
  • بررسی دقیق طول ۱۰ رقمی
  • تأیید رقم کنترل
  • جلوگیری از الگوهای نامعتبر رایج (مانند ارقام تکراری)
  • پشتیبانی از چندین زبان (انگلیسی، آلمانی، فارسی)

نحوه استفاده

import 'package:national_code_validator/national_code_validator.dart';

void main() {
  String nationalCode = "0499370899"; // نمونه کد ملی معتبر
  bool isValid = NationalCodeValidator.isValid(nationalCode);
  print(isValid); // true یا false برمی‌گرداند
}

نصب

به فایل pubspec.yaml خود اضافه کنید:

dependencies:
  national_code_validator: ^1.0.0

Additional Information

Contributing

We welcome contributions! If you'd like to contribute to this project:

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Submit a pull request

Issues

If you find any issues or have suggestions, please open an issue on our GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.