Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

Flutter package to select a country from a list

Country picker

A flutter package to select a country from a list of countries.

Getting Started

Add the package to your pubspec.yaml:

country_picker: ^1.0.4

In your dart file, import the library:

import 'package:country_picker/country_picker.dart';

Show country picker using showCountryPicker:

showCountryPicker(
   context: context,
   showPhoneCode: true, // optional. Shows phone code before the country name.
   onSelect: (Country country) {
      print('Select country: ${country.displayName}');
   },
);

Parameters:

showCountryPicker(
   context: context,
   exclude: <String>['KN', 'MF'], //It takes a list of country code(iso2).
   onSelect: (Country country) => print('Select country: ${country.displayName}'),
);

Contributions

Contributions of any kind are more than welcome! Feel free to fork and improve country_code_picker in any way you want, make a pull request, or open an issue.

Download Country picker package source code on GitHub

https://github.com/Daniel-Ioannou/flutter_country_picker

Exit mobile version
Skip to toolbar