DecimalSeparatorRewriter class

Custom formatter for text field, where only one decimal separator is allowed This separator is based on NumberFormat, so it can be "." or "," depending on the user's language.

It works if there are no group separator in the format, as it would be problematic with the 1,234,567.89 and both comma and dot.

Also, if a separator is already displayed, it will be moved to the new position

Inheritance

Constructors

DecimalSeparatorRewriter(NumberFormat format)

Properties

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

Methods

formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue
Called when text is being typed or cut/copy/pasted in the EditableText.
override
moveSeparator(String oldText, String newText, TextSelection newValueTextSelection) → MoveSeparatorResult
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replaceSeparator(String newTextValue) → String
Replaces a "." by a "," or a "," by a ".".
toString() → String
A string representation of this object.
inherited

Operators

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