Closed MojtabaMohammadzadeh closed 9 months ago
Hello @MojtabaMohammadzadeh 👋
The CountryCode
model already have that functionality, added at v1.0.7.
Example:
final phCountryCode = CountryCode.fromCode('PH');
if (phCountryCode == null) print("Ph country code not found!");
You also have the other convenient methods such as;
fromName
, fromDialCode
Thank you very much. It realy helped me . You are fantastic.
Cool, I'm glad to hear that! :)
I needed that find a CountryCode befor user select anythings by a default number. then I add this function in fl_country_code_picker.dart
Future<CountryCode?> getByCode(String CodeNumber) async{ final allCountryCodes = codes.map(CountryCode.fromMap).toList(); for (var element in allCountryCodes) {
} return null; // Return null if the code is not found/ Return null if the code is not found }
it works well for me . I used it in my code like this CountryCode? code =await countryPicker.getByCode(firstDigit);