formatPhoneNumber function
Implementation
String formatPhoneNumber(
{required String countryCode, required String phoneNumber}) {
final String _countryCode =
!countryCode.startsWith('+') ? '+$countryCode' : countryCode;
if (_countryCode == '+1') {
return '$countryCode$phoneNumber';
}
final String _phoneNumber =
phoneNumber.startsWith('0') ? phoneNumber.substring(1) : phoneNumber;
return '$_countryCode$_phoneNumber';
}