separateCountryPhoneCode function
Implementation
List<String?> separateCountryPhoneCode(String phoneNumber) {
RegExp regExp = RegExp(r'^\+(\d{1,3})\s(.+)$');
RegExpMatch? match = regExp.firstMatch(phoneNumber);
if (match != null) {
String? countryCode = match.group(1);
String? remainingNumber = match.group(2);
return [countryCode, remainingNumber];
} else {
return [null, phoneNumber];
}
}