credit_cat 1.0.0 copy "credit_cat: ^1.0.0" to clipboard
credit_cat: ^1.0.0 copied to clipboard

A library for checking credit cards with the Luhn algorithm.

credit_cat #

credit_cat is a library for checking credit card numbers using the Luhn algorithm. Besides identifying if the number is valid or not, It will also let you know who is the issuer of the card is and industry it falls under.

Overview #

import 'package:credit_cat/credit_cat.dart';

void main() {
  final cat = CreditCat("378282246310005");
  print(cat.isValid); // true
  print(cat.issuer); // Issuers.amex
  print(cat.industry); // Industries.travelAndEntertainment

  print(cat.issuer == Issuers.amex); // true
  print(cat.industry == Industries.travelAndEntertainment); // true

  final catClean = CreditCat("1*2*3*2*1*3*2*1*7", RegExp(r"\*"));
  print(catClean.number == "123213217"); // true
}

Dirty Number #

credit_cat will automatically remove any space or dashes from the string passed to it but you are also able to pass your own regular expression into CreditCat,

final catClean = CreditCat("1*2*3*2*1*3*2*1*7", RegExp(r"\*"));
print(catClean.number == "123213217"); // true
0
likes
140
pub points
0%
popularity

Publisher

unverified uploader

A library for checking credit cards with the Luhn algorithm.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on credit_cat