validateKenyanNumber function

bool validateKenyanNumber(
  1. String phone
)

validateKenyanNumber checks if a number is either has either prefix of '+254111', '+254110', '+254100', '+2540101', '+254102' or '+2547xx'

Implementation

bool validateKenyanNumber(String phone) {
  final String fifthChar = phone.substring(4, 5);
  if (fifthChar == '7' || fifthChar == '1') {
    return true;
  } else {
    return false;
  }
}