phonecodes 0.0.1 copy "phonecodes: ^0.0.1" to clipboard
phonecodes: ^0.0.1 copied to clipboard

This package provides a list of Countries with their name, ISO code, Dial code, Flag.

example/phonecodes_example.dart

import 'package:phonecodes/phonecodes.dart';

void main() {
  Country india = Countries.findByCode('IN');
  print(india.name); // India

  List<Country> countries = Countries.findByDialCode('+1');
  for (Country country in countries) {
    print('${country.name} ${country.flag}');
    // Canada πŸ‡¨πŸ‡¦
    // United States πŸ‡ΊπŸ‡Έ
  }

  Country unitedKingdom = Countries.findByName('United Kingdom');
  print(unitedKingdom.code); // GB

  try {
    Countries.findByCode('XX');
  } on CountryNotFoundException catch (e) {
    print(e); // CountryNotFoundException: Country with code XX not found
  }
}
7
likes
0
pub points
84%
popularity

Publisher

verified publisherxooniverse.com

This package provides a list of Countries with their name, ISO code, Dial code, Flag.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on phonecodes