Search packages, repositories and app categories

country_pickers cover
Package detailsv3.0.1

country_pickers

Countries, codes, flags and several way of picking them at your service...one widget away...

AndroidiOSWebmacOSWindowsLinux
30-day downloads
60.3K
Likes
179
Pub points
150

Install package

flutter pub add country_pickers

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Country Pickers is a Flutter package that provides an easy-to-use widget for selecting countries, including their codes, names, and flags. It supports multiple platforms—Android, iOS, Web, macOS, Windows, and Linux—and offers various ways to pick countries, such as through a dropdown or a searchable list. The package simplifies internationalization tasks by delivering a consistent and customizable interface for country selection in apps.

Use cases

  • International form inputs
  • Phone number input with country codes
  • User profile localization
  • Multi-region app support
  • Travel and delivery service selection

Key features

  • Built-in country flags
  • Searchable country list
  • Support for ISO country codes
  • Customizable UI
  • Multiple picker styles

Suitable for

  • Apps requiring country selection
  • Forms with international phone numbers
  • Global user onboarding
  • Localization-heavy applications
  • Cross-platform mobile and web apps

Considerations

  • Requires internet for full flag loading (if using remote images)
  • May need customization for large country lists
  • Limited to predefined country data
  • Not optimized for offline-only use
  • Flag rendering performance on low-end devices

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

country_pickers

Countries, codes, flags and several way of picking them at your service...one widget away...

CountryPickerDropdown example
 CountryPickerDropdown(
            initialValue: 'AR',
            itemBuilder: _buildDropdownItem,
            itemFilter:  ['AR', 'DE', 'GB', 'CN'].contains(c.isoCode),
            priorityList:[
                    CountryPickerUtils.getCountryByIsoCode('GB'),
                    CountryPickerUtils.getCountryByIsoCode('CN'),
                  ],
            sortComparator: (Country a, Country b) => a.isoCode.compareTo(b.isoCode),
            onValuePicked: (Country country) {
              print("${country.name}");
            },
          )
 Widget _buildDropdownItem(Country country) => Container(
        child: Row(
          children: <Widget>[
            CountryPickerUtils.getDefaultFlagImage(country),
            SizedBox(
              width: 8.0,
            ),
            Text("+${country.phoneCode}(${country.isoCode})"),
          ],
        ),
      );
CountryPickerDialog example
void _openCountryPickerDialog() => showDialog(
        context: context,
        builder: (context) => Theme(
            data: Theme.of(context).copyWith(primaryColor: Colors.pink),
            child: CountryPickerDialog(
                titlePadding: EdgeInsets.all(8.0),
                searchCursorColor: Colors.pinkAccent,
                searchInputDecoration: InputDecoration(hintText: 'Search...'),
                isSearchable: true,
                title: Text('Select your phone code'),
                onValuePicked: (Country country) =>
                    setState(() => _selectedDialogCountry = country),
                itemFilter: (c) => ['AR', 'DE', 'GB', 'CN'].contains(c.isoCode),
                priorityList: [
                  CountryPickerUtils.getCountryByIsoCode('TR'),
                  CountryPickerUtils.getCountryByIsoCode('US'),
                 ],
                itemBuilder: _buildDialogItem)),
      );
CountryPickerCupertino example
 void _openCupertinoCountryPicker() => showCupertinoModalPopup<void>(
      context: context,
      builder: (BuildContext context) {
        return CountryPickerCupertino(
          pickerSheetHeight: 300.0,
          onValuePicked: (Country country) =>
              setState(() => _selectedCupertinoCountry = country),
          itemFilter: (c) => ['AR', 'DE', 'GB', 'CN'].contains(c.isoCode),
          priorityList: [
            CountryPickerUtils.getCountryByIsoCode('TR'),
            CountryPickerUtils.getCountryByIsoCode('US'),
          ],
        );
      });

Credits

Thanks goes to country-flags repo for the flag image assets.

Categories

Source repository

Projects using this package

Rankings