Update phone number length for Congo-Brazzaville #404
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I encountered an issue when trying to register a Congo-Brazzaville phone number in the input number field. The length after the country code was set to 7 characters, but phone numbers in Congo-Brazzaville should have 9 characters after the country code, similar to the Democratic Republic of Congo (DRC), which is my country of origin.
Example of the issue:
Incorrect: +242 1234567
Correct: +242 123456789
To fix this, I updated the length in the country.dart file for Congo-Brazzaville:
Country( name: "Congo", nameTranslations: { "sk": "Konžská republika", "se": "Kongo-Brazzaville", "pl": "Kongo", "no": "Kongo-Brazzaville", "ja": "コンゴ共和国(ブラザビル)", "it": "Congo-Brazzaville", "zh": "刚果(布)", "nl": "Congo-Brazzaville", "de": "Kongo-Brazzaville", "fr": "Congo-Brazzaville", "es": "Congo", "en": "Congo - Brazzaville", "pt_BR": "República do Congo", "sr-Cyrl": "Република Конго", "sr-Latn": "Republika Kongo", "zh_TW": "剛果共和國(布拉柴維爾)", "tr": "Kongo Cumhuriyeti", "ro": "Republica Congo", "ar": "جمهورية الكونغو", "fa": "جمهوری کنگو", "yue": "剛果(共和國)" }, flag: "🇨🇬", code: "CG", dialCode: "242", minLength: 9, // updated maxLength: 9, // updated ),
I also wrote a test to confirm the changes work correctly:
test('create CG PhoneNumber from +242057009244', () { PhoneNumber phoneNumber = PhoneNumber.fromCompleteNumber(completeNumber: "+242057009244"); expect(phoneNumber.countryISOCode, "CG"); expect(phoneNumber.countryCode, "242"); expect(phoneNumber.number, "057009244"); expect(phoneNumber.isValidNumber(), true); });