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

A Dart package for validating phone numbers based on country codes. Includes country info retrieval.

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
160
points
3.94k
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package for validating phone numbers based on country codes. Includes country info retrieval.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on country_phone_validator