AsYouTypeFormatter class

A formatter which formats phone numbers as they are entered. (based on the java implementation).

An AsYouTypeFormatter can be created by new AsYouTypeFormatter(). After that, digits can be added by invoking [inputDigit] on the formatter instance, and the partially formatted phone number will be returned each time a digit is added. [clear] can be invoked before formatting a new number.

See the unittests for more details on how the formatter is to be used.

Constructs an AsYouTypeFormatter for the specific region.

_regionCode the CLDR two-letter region code that denotes the region where the phone number is being entered.

Constructors

AsYouTypeFormatter(String regionCode, PhoneNumberUtil phoneUtil)

Properties

extractedNationalPrefix String
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clears the internal state of the formatter, so it can be reused.
getRememberedPosition() int
Returns the current position in the partially formatted phone number of the character which was previously passed in as the parameter of inputDigitAndRememberPosition.
inputDigit(String nextChar) String
Formats a phone number on-the-fly as each digit is entered.
inputDigitAndRememberPosition(String nextChar) String
Same as inputDigit, but remembers the position where nextChar is inserted, so that it can be retrieved later by using getRememberedPosition. The remembered position will be automatically adjusted if additional formatting characters are later inserted/removed in front of nextChar.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited