Country Picker

A Flutter package to help you select a country from a list of countries. It includes a dropdown menu with search functionality, phone code display, and a favorite option.


  • onSelect: callback function that returns the selected country.
  • onClosed: callback function that returns when the dropdown is closed.
  • showPhoneCode: option to display the phone code of each country.
  • favorite: option to display a list of favorite countries.
  • showSearch: option to display the search bar in the dropdown.
  • countries list: all countries with their flags represented by unified characters.
  • defaultSelectedCountry: parameter to set the default selected country.


To install this package, add the following dependency to your pubspec.yaml file: dependencies: country_picker: ^0.0.2


To use this package, import it and use the CountryPicker widget in your Flutter code. You can pass the onSelect and onClosed callbacks, as well as other optional parameters, to customize the functionality.

import 'package:country_picker/country_picker.dart';

class MyWidget extends StatelessWidget { @override Widget build(BuildContext context) { return CountryPicker( onSelect: (String country) { // do something with the selected country }, onClosed: () { // do something when the dropdown is closed }, showPhoneCode: true, favorite: true, showSearch: true, defaultSelectedCountry: 'AF', ); } }


If you'd like to contribute to the development of this package, you're welcome to create a pull request or issue on the GitHub repository.