MaskedTextController class

A TextEditingController extended to provide custom masks to flutter



MaskedTextController({@required String mask, String text, Map<String, RegExp> translator})


hashCode int
The hash code for this object. [...]
read-only, inherited
hasListeners bool
Whether any listeners are currently registered. [...]
@protected, read-only, inherited
mask String
The current applied mask
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
selection TextSelection
The currently selected text. [...]
read / write, inherited
text String
The current string the user is editing.
read / write, inherited-getter, override-setter
translator Map<String, RegExp>
Translator from mask characters to RegExp
read / write
value TextEditingValue
The current value stored in this notifier. [...]
read / write, inherited


addListener(VoidCallback listener) → void
Register a closure to be called when the object changes. [...]
buildTextSpan({required BuildContext context, TextStyle style, required bool withComposing}) TextSpan
Builds TextSpan from current editing value. [...]
clear() → void
Set the value to empty. [...]
clearComposing() → void
Set the composing region to an empty range. [...]
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed). [...]
@mustCallSuper, inherited
isSelectionWithinTextBounds(TextSelection selection) bool
Check that the selection is inside of the bounds of text.
moveCursorToEnd() → void
Moves cursor to the end of the text
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
notifyListeners() → void
Call all the registered listeners. [...]
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes. [...]
toString() String
A string representation of this object. [...]
updateMask(String newMask, {bool shouldMoveCursorToEnd = true}) → void
Replaces mask with a newMask and moves cursor to the end if shouldMoveCursorToEnd is true
updateText(String newText) → void
Updates the current text with a new one applying the mask


operator ==(Object other) bool
The equality operator. [...]

Static Methods

getDefaultTranslator() Map<String, RegExp>
Default RegExp for each character available for the mask [...]