formatMask static method

String formatMask(
  1. int length,
  2. String countryCode
)

Implementation

static String formatMask(int length, String countryCode) {
  final String? mask = nationalFormats[dialCodeOf(countryCode)]?[length];
  if (mask != null) return mask;
  switch (length) {
    case 0:
      return "";
    case 7:
      return "### ####";
    case 8:
      return "#### ####";
    case 9:
      return "### ### ###";
    case 10:
      return "### ### ####";
    case 11:
      return "### #### ####";
    case 12:
      return "#### #### ####";
    default:
      return List<String>.filled(length, "#").join();
  }
}