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

Dart package for PESEL number validation

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
150
pub points
30%
popularity

Publisher

verified publisherjstepien.pl

Dart package for PESEL number validation

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

quiver

More

Packages that depend on pesel_validator