country_phone_validator 0.0.4 copy "country_phone_validator: ^0.0.4" to clipboard
country_phone_validator: ^0.0.4 copied to clipboard

A Dart package to validate phone numbers based on country codes. Retrieve country information including ISO codes and dialing codes. Ideal for applications requiring phone number validation and countr [...]

example/example.dart

import 'package:country_phone_validator/country_phone_validator.dart';

void main() {
  // Example usage to validate a phone number
  String dialCode = "+20";
  String phoneNumber = "1234567890";

  bool isValid = CountryUtils.validatePhoneNumber(phoneNumber, dialCode);

  if (isValid) {
    print("The phone number is valid.");
  } else {
    print("The phone number is invalid.");
  }

  // Example usage to retrieve country information
  Country? country = CountryUtils.getCountryByIsoCode("GB");
  if (country != null) {
    print("Country: ${country.name}, Dial Code: ${country.dialCode}");
  } else {
    print("Country not found.");
  }
}
9
likes
140
points
4.68k
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package to validate phone numbers based on country codes. Retrieve country information including ISO codes and dialing codes. Ideal for applications requiring phone number validation and country-specific formatting.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on country_phone_validator