You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that the solution should be to change the following code in intl_phone_field.dart :
Line 319 :
else {
_selectedCountry = _countryList.firstWhere((item) => item.code == (widget.initialCountryCode ?? 'US'),
orElse: () => _countryList.first);
// remove country code from the initial number value
.....
By this one :
else {
if(widget.initialCountryCode != null && widget.initialCountryCode!.startsWith('+')) {
_selectedCountry = _countryList.firstWhere((item) => item.dialCode == widget.initialCountryCode!.substring(1),
orElse: () => _countryList.first);
} else {
_selectedCountry = _countryList.firstWhere((item) => item.code == (widget.initialCountryCode ?? 'US'),
orElse: () => _countryList.first);
}
// remove country code from the initial number value
....
When we put dial code in initialCountryCode, the result is not correct :
For example :
IntlPhoneField(
initialCountryCode: '+33',
)
=> The result will show a initial country code to +93 (first country in the countries list).
If we put the ISO code, it work as expected.
The text was updated successfully, but these errors were encountered: