pesel_validator 0.1.1 copy "pesel_validator: ^0.1.1" to clipboard
pesel_validator: ^0.1.1 copied to clipboard

A dart package for PESEL number validation. Allows to extract the data that is included in PESEL.

Pesel Validator #

Pub package style: very good analysis License: MIT

A dart package for PESEL number validation

Features: #

  • 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:

dependencies:
  pesel_validator: 0.1.0

Install it:

dart pub get

Example #

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
}
1
likes
160
points
50
downloads

Publisher

verified publisherjstepien.pl

Weekly Downloads

A dart package for PESEL number validation. Allows to extract the data that is included in PESEL.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

quiver

More

Packages that depend on pesel_validator