Pesel Validator

Pub package style: very good analysis License: MIT

A dart package for PESEL number validation


  • Check if given PESEL number is valid
  • Extract gender from PESEL
  • Extract date of birth from PESEL
  • Extract age from PESEL

Installation 💻

❗ In order to start using Pesel Validator you must have the Dart SDK installed on your machine.

Add pesel_validator to your pubspec.yaml:

  pesel_validator: 0.1.0

Install it:

dart pub get


See example/example.dart

import 'package:pesel_validator/pesel_validator.dart';

void main() {
  const validPesel = '92071314764';
  const invalidPesel = '00000000000';

  // pesel number validation
  validatePesel(pesel: validPesel); // true
  validatePesel(pesel: invalidPesel); // false

  // sex from pesel number
  sexFromPesel(pesel: validPesel); // Sex.woman
  // sexFromPesel(pesel: invalidPesel); // throws InvalidPeselException

  // date of birth from pesel
  dateOfBirthFromPesel(pesel: validPesel); // DateTime (13.07.1992)
  // dateOfBirthFromPesel(pesel: invalidPesel); // throws InvalidPeselException

  // age from pesel
  ageFromPesel(pesel: validPesel); // int age value
  // ageFromPesel(pesel: invalidPesel); // throws InvalidPeselException


Dart package for PESEL number validation