showCountryPicker function

Future<Country?> showCountryPicker({
  1. required BuildContext context,
  2. required Country defaultCountry,
})

Display a Dialog with the country list to selection you can pass and defaultCountry, see Country.findByIsoCode

Implementation

Future<Country?> showCountryPicker({
  required BuildContext context,
  required Country defaultCountry,
}) async {
  assert(Country.findByIsoCode(defaultCountry.isoCode) != null);

  return await showDialog<Country>(
    context: context,
    barrierDismissible: true,
    builder: (BuildContext context) => _CountryPickerDialog(
      defaultCountry: defaultCountry,
    ),
  );
}