localeResolutionCallback property

LocaleResolutionCallback localeResolutionCallback
final

This callback is responsible for choosing the app's locale when the app is started, and when the user changes the device's locale.

The returned value becomes the locale of this app's Localizations widget. The callback's locale parameter is the device's locale when the app started, or the device locale the user selected after the app was started. The callback's supportedLocales parameter is just the value supportedLocales.

An app could use this callback to substitute locales based on the app's intended audience. If the device's OS provides a prioritized list of locales, this callback could be used to defer to it.

If the callback is null then the resolved locale is:

  • The callback's locale parameter if it's equal to a supported locale.
  • The first supported locale with the same Locale.languageCode as the callback's locale parameter.
  • The first supported locale.

This callback is passed along to the WidgetsApp built by this widget.

Implementation

final LocaleResolutionCallback localeResolutionCallback