dialCodeFromLocale static method

String? dialCodeFromLocale({
  1. Locale? locale,
})

Returns the dialCode for the given locale or device's locale, if not provided.

Example: (1, 351, etc.)

Implementation

static String? dialCodeFromLocale({Locale? locale}) {
  String? code = _resolveLocale(locale);
  Country? country =
      allCountries.firstWhereSafe((country) => country.a2 == code);
  return country?.dial;
}