phonecodes 0.0.2 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 #
- Have access to all the country codes.
- Get the country code by country name.
- Get the country name by country code.
- 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.