countries_list 0.1.6 copy "countries_list: ^0.1.6" to clipboard
countries_list: ^0.1.6 copied to clipboard

outdated

ISO-3166 Country and Dependent Territories Lists with UN Regional Codes. Country object contains phone code, flag emoji, alpha1, alpha2 etc. You can use it for creating your own country picker.

example/lib/main.dart

import 'package:countries_list/countries_list.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Countries list'),
        ),
        body: FutureBuilder<List<Country>>(
          future: getCountriesIso(),
          builder: (ctx, snapshot) {
            if (snapshot.connectionState == ConnectionState.waiting) {
              return Center(
                child: CircularProgressIndicator(),
              );
            } else {
              final countries = snapshot.data;
              return ListView.builder(
                itemBuilder: (ctx, index) {
                  Country country = countries[index];
                  return ListTile(
                    leading: Text(
                      country.flag,
                      style: TextStyle(fontSize: 32),
                    ),
                    title: Text(
                        '${country.latinName} (${country.countryIso.alpha2})'),
                    subtitle: country.phoneCode != null
                        ? Text('phone code: +${country.phoneCode}')
                        : Text('Phone code not found'),
                  );
                },
                itemCount: countries.length,
              );
            }
          },
        ),
      ),
    );
  }
}
0
likes
30
pub points
41%
popularity

Publisher

unverified uploader

ISO-3166 Country and Dependent Territories Lists with UN Regional Codes. Country object contains phone code, flag emoji, alpha1, alpha2 etc. You can use it for creating your own country picker.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on countries_list