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

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

Phone Codes 🌍 #

A list of all the country codes, dial codes, their corresponding country names, and flag.

Features #

  1. Have access to all the country codes.
  2. Get the country code by country name.
  3. Get the country name by country code.
  4. Get the country by dial code.

βš™οΈ Getting started #

Install the package by adding the following line into your pubspec.yaml file:

dependencies:
  phonecodes: <VERSION>

Now import the package into your project:

import 'package:phonecodes/phonecodes.dart';

πŸ“š Usage #

Find Country πŸ” #

To find the dial code of a specific country, use the following code:

var country = Countries.findByName("United Kingdom");

print(country.flag); // πŸ‡¬πŸ‡§

Similarly, you can get the country code, country name, and country flag by country name, country code, and dial code.

var c1 = Countries.findByName("United Kingdom");
var c2 = Countries.findByCode("GB");
var c3 = Countries.findByDialCode("+44");

If the country is not found, an exception will be thrown.

Model πŸ§‘πŸ»β€πŸ’» #

Country object is as shown below:

class Country {
  final String name;
  final String code;
  final String dialCode;
  final String flag;

  const Country({
    required this.name,
    required this.code,
    required this.dialCode,
    required this.flag,
  });
}

Contribute πŸ’» #

If you'd like to have a feature added, please open an issue or create a pull request.

License πŸ”‘ #

License details can be found in the LICENSE file.

11
likes
0
points
7.24k
downloads

Publisher

verified publisherxooniverse.com

Weekly Downloads

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

License

unknown (license)

More

Packages that depend on phonecodes