updateMask method
TextEditingValue
updateMask({
- String? mask,
- Map<
String, RegExp> ? filter, - MaskAutoCompletionType? type,
- TextEditingValue? newValue,
Change the mask
Implementation
TextEditingValue updateMask({ String? mask, Map<String, RegExp>? filter, MaskAutoCompletionType? type, TextEditingValue? newValue}) {
_mask = mask;
if (filter != null) {
_updateFilter(filter);
}
if (type != null) {
_type = type;
}
_calcMaskLength();
TextEditingValue? targetValue = newValue;
if (targetValue == null) {
final unmaskedText = getUnmaskedText();
targetValue = TextEditingValue(text: unmaskedText, selection: TextSelection.collapsed(offset: unmaskedText.length));
}
clear();
return formatEditUpdate(TextEditingValue.empty, targetValue);
}