MaskedTextController constructor

MaskedTextController({
  1. String? text,
  2. required String mask,
  3. Map<String, RegExp>? translator,
})

Implementation

MaskedTextController(
    {String? text, required this.mask, Map<String, RegExp>? translator})
    : super(text: text) {
  this.translator = translator ?? MaskedTextController.getDefaultTranslator();

  addListener(() {
    final String previous = _lastUpdatedText;
    if (beforeChange(previous, this.text)) {
      updateText(this.text);
      afterChange(previous, this.text);
    } else {
      updateText(_lastUpdatedText);
    }
  });

  updateText(this.text);
}