isShebaValid method

bool isShebaValid(
  1. String sheba
)

Implementation

bool isShebaValid(String sheba) {
  if (sheba.length != 26) return false;
  if (!RegExp(r'IR[0-9]{24}').hasMatch(sheba)) return false;
  final d1 = sheba.codeUnitAt(0) - 65 + 10;
  final d2 = sheba.codeUnitAt(1) - 65 + 10;
  var iban = sheba.substring(4);
  iban += '$d1$d2${sheba.substring(2, 4)}';
  final remainder = _iso7064Mod97_10(iban);
  return remainder != 1 ? false : true;
}