findCountryCode method

String? findCountryCode({
  1. BuildContext? context,
})

Implementation

String? findCountryCode({BuildContext? context}) {
  Locale? locale;
  if (context != null) {
    locale = Localizations.maybeLocaleOf(context);
  } else {
    locale = PlatformDispatcher.instance.locale;
  }
  final code = locale == null || locale.countryCode == null
      ? 'US'
      : locale.countryCode;
  return code;
}