Package selection guidance compiled from public package information, community data, and project usage.
A Dart package that enables international phone number handling using Google's libphonenumber library. It provides robust functionality for parsing, validating, formatting, and determining the region of phone numbers across global formats. Ideal for apps requiring accurate phone number processing in diverse regions, it supports all major platforms including mobile, web, and desktop. The package ensures consistency and correctness in user input validation and display, reducing errors in international communication workflows.
Use cases
Validating international phone numbers
Formatting phone numbers by region
Parsing phone number metadata
Detecting country from a number
Supporting multi-region user inputs
Key features
Based on Google's libphonenumber
Cross-platform support
Comprehensive validation
Region-specific formatting
Automatic number type detection
Suitable for
Global applications with user registration
Telecom or messaging apps
International form inputs
Apps requiring accurate number parsing
Developers needing reliable phone number logic
Considerations
Requires careful handling of region codes
May increase app size slightly
Depends on native code for full functionality
Limited to supported countries in libphonenumber
Needs proper error handling for invalid inputs
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Dart LibPhoneNumber
A Dart package for working with international phone numbers based on Google's libphonenumber implementation. It parses, formats, and validates numbers without relying on native dependencies.
✨ Features
✅ Parse, format, and validate phone numbers [parse(), format(), isValidNumber()]
➝ Convert raw phone numbers into structured objects, apply different formats, and check validity.
✅ Identify phone number types [getNumberType()]
➝ Distinguishes between Fixed-line, Mobile, Toll-free, Premium Rate, VoIP, etc.
✅ Match and compare phone numbers [isNumberMatch()]
➝ Determines whether two numbers are the same or similar.
✅ Generate example phone numbers [getExampleNumber()]
➝ Provides valid phone number examples for various countries/regions.
✅ Perform quick validation [isPossibleNumber()]
➝ Checks if a number has a valid length without requiring region-specific details.
✅ Validate phone numbers for a specific region [isValidNumberForRegion()]
➝ Ensures a phone number is valid in the given country based on length and prefix rules.
✅ Format phone numbers as-you-type [getAsYouTypeFormatter()]
➝ Dynamically formats phone numbers as users enter each digit.
✅ Extract phone numbers from text [findNumbers()]
➝ Detects phone numbers within a block of text (e.g., 'Call me on 0241234567').
✅ Geocode phone numbers [getDescriptionForNumber()]
➝ Retrieves geographical information related to a phone number (e.g., 'Zurich' for a Swiss number).
✅ Retrieve carrier information [getNameForNumber()]
➝ Identifies the telecom provider associated with a number (e.g., 'AT&T', 'Vodafone').
✅ Find associated timezones [getTimeZonesForNumber()]
➝ Returns timezone(s) linked to a phone number (e.g., 'America/New_York').
🚀 Quick Start
📌 Installation
Add dlibphonenumber to your pubspec.yaml:
dependencies:dlibphonenumber:^1.1.35#replace with the current version number.