replacePhoneMask static method
Replaces an existing phone mask for the given country e.g. Russian mask right now is +0 (000) 000-00-00 if you want to replace it by +0 (000) 000 00 00 simply call this method like this PhoneInputFormatter.replacePhoneMask( countryCode: 'RU', newMask: '+0 (000) 000 00 00', );
Implementation
static void replacePhoneMask({
required String countryCode,
required String newMask,
}) {
checkMask(newMask);
final countryData = _findCountryDataByCountryCode(countryCode);
var currentMask = countryData['phoneMask'];
if (currentMask == newMask) {
return;
}
if (kDebugMode) {
print(
'Phone mask for country "${countryData['country']}"' +
' was replaced from $currentMask to $newMask',
);
}
countryData['phoneMask'] = newMask;
}