format static method
Formats number (digits only or partially typed) according to the
national pattern defined for country.
- Strips all non-digit characters first.
- Clamps to
country.maxLengthdigits. - Applies the pattern progressively as the user types.
Implementation
static String format(String number, CountryModel country) {
final clean = _digitsOnly(number, maxLen: country.maxLength);
if (clean.isEmpty) return '';
return _applyPattern(clean, country.pattern);
}