smart_phone_number 1.0.3
smart_phone_number: ^1.0.3 copied to clipboard
A smart phone number parser that automatically detects country codes from number prefixes and validates WhatsApp accounts
Smart Phone Number 📱 #
A powerful Flutter package for detecting, validating, and verifying phone numbers with WhatsApp integration. It automatically detects the country code from the number prefix and validates if the number exists on WhatsApp.
✨ Features #
- 🎯 Automatic Country Detection: Detects the country from the number prefix
- 🌍 IP Geolocation: Uses IP to resolve conflicts between similar prefixes
- 💬 WhatsApp Validation: Checks if the phone number exists on WhatsApp
- 🔧 Flexible API: Multiple ways to validate numbers
- 🌐 Multi-language Support: Country names in both English and Arabic
- 📱 Cross-platform: Works on Android, iOS, and Web
🚀 Getting Started #
Installation #
Add this to your pubspec.yaml:
dependencies:
smart_phone_number: ^1.0.2
Android Setup #
For Android, add the following permissions to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
Add this inside the <queries> tag (Android 11+):
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="whatsapp" />
</intent>
</queries>
IOS Setup #
For iOS, add this to ios/Runner/Info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
</array>
Usage #
Basic Usage - Auto Detection
import 'package:smart_phone_number/smart_phone_number.dart';
// Automatically detect country and validate WhatsApp
PhoneResult result = await SmartPhoneNumber.detectAndValidate('712345678');
if (result.success) {
print('✅ WhatsApp account found!');
print('📱 Number: ${result.phoneNumber}');
print('🌍 Country Code: ${result.countryCode}');
print('📍 Region: ${result.regionCode}');
} else {
print('❌ ${result.message}');
}```