setCountry method

void setCountry(
  1. CountryModel? newCountry
)

Implementation

void setCountry(CountryModel? newCountry) {
  clear();
  selectedCountry = newCountry;
  maskFormatter.updateMask(
    mask: selectedCountry?.format,
    filter: {'.': RegExp(r'[0-9]')},
    newValue: TextEditingValue(text: selectedCountry?.currentAreaCode ?? ''),
  );

  text = maskFormatter.maskText(newCountry?.currentAreaCode ?? '');

  notifyListeners();
}