@@ -9,7 +9,7 @@ class CountryDropdown extends StatefulWidget {
99 final CountryItemBuilder ? selectedItemBuilder;
1010 final CountryItemBuilder ? listItemBuilder;
1111 final bool printCountryName;
12- final String ? initialPhoneCode ;
12+ final PhoneCountryData ? initialCountryData ;
1313 final List <PhoneCountryData >? filter;
1414 final ValueChanged <PhoneCountryData > onCountrySelected;
1515
@@ -34,7 +34,7 @@ class CountryDropdown extends StatefulWidget {
3434
3535 /// [filter] if you need a predefined list of countries only,
3636 /// pass it here
37- /// [initialPhoneCode] a phone code of the country without leading +
37+ /// [initialCountryData] initial country data to be selected
3838 /// [selectedItemBuilder] use this if you want to make
3939 /// the selected item look the way you want
4040 /// [listItemBuilder] the same as [selectedItemBuilder] but
@@ -50,7 +50,7 @@ class CountryDropdown extends StatefulWidget {
5050 this .selectedItemBuilder,
5151 this .listItemBuilder,
5252 this .printCountryName = false ,
53- this .initialPhoneCode ,
53+ this .initialCountryData ,
5454 this .triggerOnCountrySelectedInitially = true ,
5555 this .filter,
5656 required this .onCountrySelected,
@@ -84,9 +84,9 @@ class _CountryDropdownState extends State<CountryDropdown> {
8484 @override
8585 void initState () {
8686 _countryItems = widget.filter ?? PhoneCodes .getAllCountryDatas ();
87- if (widget.initialPhoneCode != null ) {
88- _initialValue = _countryItems. firstWhereOrNull (
89- ( c) => c.phoneCode == widget.initialPhoneCode ) ??
87+ if (widget.initialCountryData != null ) {
88+ _initialValue = _countryItems
89+ . firstWhereOrNull (( c) => c == widget.initialCountryData ) ??
9090 _countryItems.first;
9191 }
9292 if (widget.triggerOnCountrySelectedInitially && _initialValue != null ) {
0 commit comments