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

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

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
160
pub points
84%
popularity

Publisher

verified publisherxooniverse.com

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

Repository (GitHub)
View/report issues

Topics

#country-codes #countries #currency #dial-codes #flags

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on phonecodes