I am quite new in flutter I am building flutter dropdown country list using country_pickers: ^2.0.0, I am going to enclude only some countries, how can filter them.
I am quite new in flutter I am building flutter dropdown country list using country_pickers: ^2.0.0, I am going to enclude only some countries, how can filter them.
CountryPicker has actually a field to make that:
child: ElevatedButton(
onPressed: () {
showCountryPicker(
context: context,
exclude: ['EN', 'PL','ES'],
....
....
),
);
},
child: ...,
),
You can use exclude property by passing a list of unwanted countries.
For more info check explanation : country picker
It's very simple, you have to set countries isoCode list to the countryFilter.
showCountryPicker(
context: context,
countryFilter: <String>['CD', 'CG', 'KE', 'UG'], // only specific countries
onSelect: (){....},
)