prettyText method
A convenience function to call to autofill fields. Possible example:
final _muskeyFormatter = MuskeyFormatter(masks: [...]);
final _phoneController = TextEditingController();
@override
void initState() {
super.initState();
_phoneController.text = _muskeyFormatter.prettyText(myBloc.user.phone);
}
If no mask was found, will still produce result. In this case,
the result will be equal to input
.
Implementation
String prettyText(String input) {
return formatEditUpdate(
TextEditingValue(
text: input,
selection: TextSelection.collapsed(
offset: input.length,
),
),
TextEditingValue(
text: input,
selection: TextSelection.collapsed(
offset: input.length,
),
),
).text;
}