identifyMultiple static method
A batch identify wrapper on top of identify func
cardNumString
The card number to identify.
validateLength
Validate the length as part of the String identification.
A false value can be useful to identify the fragment of a card number.
Default is true.
useCheck
Validate the card number as part of the String identification.
A false value can be useful to identify the fragment of a card number.
The validation will be the issuing network's validation, mostly Luhn.
Default is true.
ignoreNoise
Ignore common noise found in card number.
This noise is any of - .
. Default is false.
handleAnonymization
Set any non-digits to zero.
It is common to use "X" and "#" to hide some digits. Default is false.
var card1 = "2201200000000000";
var card2 = "5110710000901089";
var identifiedCardsMap = FlutterCardidy.Identify([card1, card2]);
returns a map of CardNumber (key)
and Identified Card Type (value)
Implementation
static Map<String, List<CardType>> identifyMultiple(
List<String> cards, {
bool validateLength = true,
bool useCheck = true,
bool ignoreNoise = false,
bool handleAnonymization = false,
}) {
Map<String, List<CardType>> results = {};
if (cards.isNotEmpty) {
for (var cardNum in cards) {
var identifiedVendors = identify(
cardNum,
validateLength: validateLength,
useCheck: useCheck,
ignoreNoise: ignoreNoise,
handleAnonymization: handleAnonymization,
);
results.putIfAbsent(cardNum, () => identifiedVendors);
}
}
return results;
}