codeType static method

UCodeType codeType(
  1. String? code
)

Implementation

static UCodeType codeType(String? code) {
  if (code == null || !RegExp(r"^\d+$").hasMatch(code)) return UCodeType.unknown;
  switch (code.length) {
    case 3:
      return UCodeType.country;
    case 7:
      return UCodeType.province;
    case 6:
      return UCodeType.city;
    default:
      return UCodeType.unknown;
  }
}