checkdigit 0.2.0

Dart native js
Flutter Android iOS web

A set of check digit algorithms used for error detection on identification numbers.

Checkdigit #

Star on GitHub style: effective dart License: MIT

A set of check digit algorithms used for error detection on identification numbers.

Installation #

In pubspec.yaml add the following dependency:

dependencies:
  checkdigit: ^0.2.0

Algorithms #

Luhn #

bool isValid = luhn.validate('79927398713');
int checkDigit = luhn.checkDigit('7992739871');
String checkDigitAsString = luhn.checkDigitAsString('7992739871');

Verhoeff #

bool isValid = verhoeff.validate('2363');
int checkDigit = verhoeff.checkDigit('236');
String checkDigitAsString = verhoeff.checkDigitAsString('236');

Damm #

bool isValid = damm.validate('5724');
int checkDigit = damm.checkDigit('572');
String checkDigitAsString = damm.checkDigitAsString('572');

ISBN #

// ISBN-10.
bool isValid = isbn10.validate('080442957X');
int checkDigit = isbn10.checkDigit('080442957');
String checkDigitAsString = isbn10.checkDigitAsString('080442957');
// ISBN-13.
bool isValid = isbn13.validate('9783161484100');
int checkDigit = isbn13.checkDigit('978316148410');
String checkDigitAsString = isbn13.checkDigitAsString('978316148410');

ISIN #

bool isValid = isin.validate('US0378331005');
int checkDigit = isin.checkDigit('US037833100');
String checkDigitAsString = isin.checkDigitAsString('US037833100');

CPF #

bool isValid = cpf.validate('11144477735');
int checkDigit = cpf.checkDigit('111444777');
String checkDigitAsString = cpf.checkDigitAsString('111444777');

IBAN #

bool isValid = iban.validate('GB82WEST12345698765432');
int checkDigit = iban.checkDigit('GB00WEST12345698765432');
String checkDigitAsString = iban.checkDigitAsString('GB00WEST12345698765432');

CNPJ #

bool isValid = cnpj.validate('11222333000181');
int checkDigit = cnpj.checkDigit('112223330001');
String checkDigitAsString = cnpj.checkDigitAsString('112223330001');

EAN-X #

// EAN-13.
bool isValid = ean13.validate('4006381333931');
int checkDigit = ean13.checkDigit('400638133393');
String checkDigitAsString = ean13.checkDigitAsString('400638133393');
// UPC-A.
bool isValid = upcA.validate('036000291452');
int checkDigit = upcA.checkDigit('03600029145');
String checkDigitAsString = upcA.checkDigitAsString('03600029145');
// EAN-8.
bool isValid = ean8.validate('73513537');
int checkDigit = ean8.checkDigit('7351353');
String checkDigitAsString = ean8.checkDigitAsString('7351353');
1
likes
110
pub points
59%
popularity

Publisher

tiagohm.dev

A set of check digit algorithms used for error detection on identification numbers.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on checkdigit