validateCountryCode function
void
validateCountryCode(
- String bic
)
Implementation
void validateCountryCode(String bic) {
String countryCode = getCountryCode(bic).trim();
if (countryCode.length < COUNTRY_CODE_LENGTH ||
countryCode != countryCode.toUpperCase() ||
!RegExp(ucRegex).hasMatch(countryCode)) {
throw FormatException(
"Bic country code must contain upper case letters. Code:$countryCode",
);
}
if (Country.countryByCode(countryCode) == null) {
throw Exception("Country code is not supported. Code:$countryCode");
}
}