getCurrentLocale static method

Locale getCurrentLocale({
  1. BuildContext? context,
})

Get the current system locale. Uses the context if available, otherwise falls back to platform dispatcher.

Implementation

static Locale getCurrentLocale({BuildContext? context}) {
  if (context != null) {
    return Localizations.localeOf(context);
  }
  return ui.PlatformDispatcher.instance.locale;
}