LocaleResolutionCallback typedef

Locale LocaleResolutionCallback (Locale locale, Iterable<Locale> supportedLocales)

The signature of WidgetsApp.localeResolutionCallback.

It is recommended to provide a LocaleListResolutionCallback instead of a LocaleResolutionCallback when possible, as LocaleResolutionCallback only receives a subset of the information provided in LocaleListResolutionCallback.

A LocaleResolutionCallback is responsible for computing the locale of the app's Localizations object when the app starts and when user changes the default locale for the device after LocaleListResolutionCallback fails or is not provided.

This callback is also used if the app is created with a specific locale using the new WidgetsApp locale parameter.

The locale is either the value of WidgetsApp.locale, or the device's default locale when the app started, or the device locale the user selected after the app was started. The default locale is the first locale in the list of preferred locales. If locale is null, then Flutter has not yet received the locale information from the platform. The supportedLocales parameter is just the value of WidgetsApp.supportedLocales.

See also:

Implementation

typedef LocaleResolutionCallback = Locale Function(Locale locale, Iterable<Locale> supportedLocales);