locales property Null safety

List<Locale> locales

The full system-reported supported locales of the device.

Accessing this value returns the value contained in the PlatformDispatcher singleton, so instead of getting it from here, you should consider getting it from WidgetsBinding.instance.platformDispatcher instead (or, when WidgetsBinding isn't available, from PlatformDispatcher.instance). The reason this value forwards to the PlatformDispatcher is to provide convenience for applications that only use a single main window.

This establishes the language and formatting conventions that window should, if possible, use to render their user interface.

The list is ordered in order of priority, with lower-indexed locales being preferred over higher-indexed ones. The first element is the primary locale.

The onLocaleChanged callback is called whenever this value changes.

See also:

Implementation

List<Locale> get locales => platformDispatcher.locales;