mod9710 function
Mod 97/10 calculation
@ignore
Implementation
int mod9710(String validationString) {
while (validationString.length > 2) {
// > Any computer programming language or software package that is used to compute D
// > mod 97 directly must have the ability to handle integers of more than 30 digits.
// > In practice, this can only be done by software that either supports
// > arbitrary-precision arithmetic or that can handle 219-bit (unsigned) integers
// https://en.wikipedia.org/wiki/International_Bank_Account_Number#Modulo_operation_on_IBAN
late final String part;
try {
part = validationString.substring(0, 6);
} on RangeError catch (_) {
part = validationString;
}
final int partInt = int.parse(part, radix: 10);
validationString =
'${(partInt % 97)}${validationString.substring(part.length)}';
}
return int.parse(validationString, radix: 10) % 97;
}