MaskedTextController constructor

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

Implementation

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

  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);
}