findSystemLocale function

Future<String> findSystemLocale()

Find the system locale, accessed via the appropriate system APIs, and set it as the default for internationalization operations in the Intl.systemLocale variable.

Implementation

Future<String> findSystemLocale() {
  try {
    Intl.systemLocale = Intl.canonicalizedLocale(Platform.localeName);
  } catch (e) {
    return Future.value(Intl.systemLocale);
  }
  return Future.value(Intl.systemLocale);
}