MaskedTextController constructor

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

Implementation

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

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

  updateText(this.text);
}