checkPolandBBAN function

bool checkPolandBBAN(
  1. String bban
)

Used for Poland BBAN check

@ignore

Implementation

bool checkPolandBBAN(String bban) {
  const List<int> weights = <int>[3, 9, 7, 1, 3, 9, 7];
  final int controlDigit = int.parse(bban[7], radix: 10);
  final String toCheck = bban.substring(0, 7);
  int sum = 0;
  for (int index = 0; index < 7; index++) {
    sum += int.parse(toCheck[index], radix: 10) * weights[index];
  }
  final int remainder = sum % 10;

  return controlDigit == (remainder == 0 ? 0 : 10 - remainder);
}