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

outdated

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
0
pub points
80%
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

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on the_country_number