Skip to content

Commit

Permalink
Modified dialcode handler
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkWithAfridi committed Jun 19, 2023
1 parent 73b97ff commit de81b17
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/country_data/country_dial_codes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ class DialCodeHandler {

String? getDialCode(String phoneNumber) {
for (final dialCode in countryDialCodes.values) {
if (phoneNumber.startsWith(dialCode)) {
if (phoneNumber.startsWith(dialCode) || phoneNumber.startsWith(dialCode.substring(1, dialCode.length))) {
return dialCode;
} else if (phoneNumber.endsWith(dialCode)) {
return dialCode;
}
}
Expand Down

0 comments on commit de81b17

Please sign in to comment.