uzbek_phone_input 0.0.1
uzbek_phone_input: ^0.0.1 copied to clipboard
A lightweight Flutter TextInputFormatter for Uzbekistan phone numbers.
π± UzbekPhoneFormatter
A lightweight Flutter TextInputFormatter for Uzbekistan phone numbers. Formats input into the common mask:
+998 ## ###-##-##
Includes built-in validation and E.164 conversion helpers.
β¨ Features
Automatic formatting while typing or pasting
Mask style: +998 90 123-45-67
Validation with operator code checks
Conversion to E.164 format: +998901234567
No external dependencies, single class
π Installation
Add to your pubspec.yaml:
dependencies: uzbek_phone_formatter: ^0.1.0
Then import it:
import 'package:uzbek_phone_formatter/uzbek_phone_formatter.dart';
π Usage TextFormField( keyboardType: TextInputType.phone, decoration: const InputDecoration( labelText: 'Telefon', hintText: '+998 90 123-45-67', ), inputFormatters: [ FilteringTextInputFormatter.digitsOnly, UzbekPhoneFormatter(), ], validator: UzbekPhoneFormatter.validate, onSaved: (v) { final e164 = UzbekPhoneFormatter.toE164(v ?? ''); print(e164); // -> +998901234567 }, );
β Validation final result = UzbekPhoneFormatter.validate('+998 90 123-45-67'); if (result == null) { print('Valid number'); } else { print(result); // error message }
π Convert to E.164 final e164 = UzbekPhoneFormatter.toE164('+998 90 123-45-67'); // -> "+998901234567"
π Roadmap
Support for multiple country masks
Configurable operator code validation
Unit tests for edge cases
π License
MIT License.