smart_phone_parser library

Smart Phone Parser

A professional international phone number parsing and validation package for Flutter. Provides automatic country detection, formatting, and a customizable widget.

Quick Start

final controller = SmartPhoneController();

SmartPhoneField(
  controller: controller,
)

Profile Edit

final controller = SmartPhoneController.fromFullNumber("+201234567890");

With Form Validation

Form(
  child: SmartPhoneField(
    controller: controller,
    validator: PhoneValidator.required,
  ),
)

Custom Styling

SmartPhoneField(
  controller: controller,
  theme: SmartPhoneTheme.light.copyWith(
    borderRadius: BorderRadius.circular(30),
    borderColor: Colors.blue,
  ),
)

Classes

CountryBottomSheet
CountryDialog
ParsedPhone
Immutable model representing a parsed phone number
ParserCountry
Represents a country with its phone dialing information
PhoneFormatter
Formats phone numbers for display
PhoneParser
PhoneRules
PhoneValidator
Validation utilities for phone numbers
SmartPhoneController
SmartPhoneField
SmartPhoneTheme
Theme configuration for SmartPhoneField

Extensions

PhoneFormatExtension on ParsedPhone
Extension for ParsedPhone formatting
PhoneParsingExtension on String
Extension for parsing phone numbers from strings
PhoneValidationExtension on String
Convenience extension for validation

Functions

showSmartCountryPicker({required BuildContext context, CountryPickerType type = CountryPickerType.bottomSheet, List<String> favoriteCountries = const [], ParserCountry? selectedCountry}) Future<ParserCountry?>