AsYouTypeFormatter class
AsYouTypeFormatter is a custom formatter that extends TextInputFormatter which provides as you type validation and formatting for phone number inputted.
- Inheritance
-
- Object
- TextInputFormatter
- AsYouTypeFormatter
Constructors
-
AsYouTypeFormatter({required String isoCode, required String dialCode, required OnInputFormatted<
TextEditingValue> onInputFormatted})
Properties
- allowedChars → RegExp
-
The allowedChars contains RegExp for allowable phone number characters.
final
- dialCode → String
-
The dialCode of the Country formatting the phone number to
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isoCode → String
-
The isoCode of the Country formatting the phone number to
final
-
onInputFormatted
→ OnInputFormatted<
TextEditingValue> -
onInputFormatted is a callback that passes the formatted phone number
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- separatorChars → RegExp
-
Contains characters allowed as seperators.
final
Methods
-
formatAsYouType(
{required String input}) → Future< String?> -
Accepts
input
, unformatted phone number and returns a Future<String> of the formatted phone number. -
formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue -
Called when text is being typed or cut/copy/pasted in the EditableText.
override
-
isPartOfNorthAmericanNumberingPlan(
String dialCode) → bool -
Accepts a
dialCode
returns a bool, true if thedialCode
is part of North American Numbering Plan -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parsePhoneNumber(
String? phoneNumber) → String -
Accepts a formatted
phoneNumber
returns a String ofphoneNumber
with the dialCode replaced with an empty String -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited