the_country_number 0.9.2+7 copy "the_country_number: ^0.9.2+7" to clipboard
the_country_number: ^0.9.2+7 copied to clipboard

A small library for flutter written in pure dart (doesn't use libphonenumber) which parses a phone number or iso2 code of a country to give you some vitals about the country (if you need to skip null- [...]

example/example.dart

import 'package:the_country_number/the_country_number.dart';

void main(){
  //String to parse (internationalNumber)
  final s = "+915656565656";
  //
  //String to parse (dialCode)
  final b = "+91";
  //
  //get details about s
  final sNumber = TheCountryNumber().parseNumber(internationalNumber: s);
  //check if the value is actually a TheNumber
  if(sNumber.isNotANumber()){
    //not a TheNumber
    return;
  }
  print(sNumber.isValidLength); //prints true
  print(sNumber.country.englishName);//prints india
  print(sNumber.hasNumber);//prints true
  //
  //get details about s
  final bNumber = TheCountryNumber().parseNumber(dialCode: b);
  //check if the value is actually a TheNumber
  if(bNumber.isNotANumber()){
    //not a TheNumber
    return;
  }
  print(bNumber.isValidLength); //prints false
  print(bNumber.country.englishName);//prints india
  print(bNumber.hasNumber);//prints false
}
5
likes
150
pub points
83%
popularity

Publisher

verified publisheryadunandan.xyz

A small library for flutter written in pure dart (doesn't use libphonenumber) which parses a phone number or iso2 code of a country to give you some vitals about the country (if you need to skip null-safety, use version 0.9.0)

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on the_country_number