removeCountryCode static method

String removeCountryCode(
  1. String phoneWithCountryCode
)

Removes a country code from a phone

Implementation

static String removeCountryCode(
  String phoneWithCountryCode,
) {
  final countryData = getCountryDataByPhone(phoneWithCountryCode);
  if (countryData != null) {
    phoneWithCountryCode = phoneWithCountryCode.replaceAll('+', '').trim();
    return phoneWithCountryCode.substring(countryData.phoneCode!.length);
  }
  return phoneWithCountryCode;
}